|
|
- <?php
-
- namespace App;
-
- use Jenssegers\Blade\Blade;
-
- /**
- *
- *
- *
- *
- */
- class BladeFile
- {
- // cache dir
- const CACHE_DIR = '/storage/cache';
-
- // blade engine
- private $blade;
-
- /**
- *
- *
- *
- * @param {string} $templateDir
- *
- */
- public function __construct($templateDir)
- {
- $this->blade = new Blade(base_path().$templateDir, base_path().self::CACHE_DIR);
- }
-
- /**
- * put to file
- *
- * @param {string} $template
- * @param {string} $fullpath
- * @param {array} $data
- *
- */
- public function put($template, $fullpath, $data)
- {
- $content = $this->blade->render($template, $data);
- file_put_contents($fullpath, $content);
- }
- }
|