|
|
- <?php
-
- namespace App;
-
- use Jenssegers\Blade\Blade;
-
- /**
- * wrapper for blade
- *
- *
- * @author Björn Hase, Tentakelfabrik
- * @license http://opensource.org/licenses/MIT The MIT License
- * @link https://gitea.tentakelfabrik.de/Tentakelfabrik/mcp
- *
- */
- class BladeFile
- {
- // cache dir
- const CACHE_DIR = '/storage/cache';
-
- // blade engine
- private $blade;
-
- /**
- * create 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);
- }
- }
|