1 <?php
2
3 namespace Scaffolder\Compilers\Layout;
4
5 use Illuminate\Support\Facades\File;
6 use Scaffolder\Compilers\AbstractViewCompiler;
7 use Scaffolder\Support\Contracts\ScaffolderThemeExtensionInterface;
8 use Scaffolder\Support\FileToCompile;
9 use Scaffolder\Support\PathParser;
10 use stdClass;
11
12 class CreateLayoutCompiler extends AbstractViewCompiler
13 {
14 15 16 17 18 19 20 21 22 23 24 25 26 27
28 public function compile($stub, $modelName, $modelData, stdClass $scaffolderConfig, $hash, ScaffolderThemeExtensionInterface $themeExtension, array $extensions, $extra = null)
29 {
30 $this->stub = $stub;
31
32 return $this->store(null, $scaffolderConfig, $themeExtension->runAfterCreateLayoutIsCompiled($this->stub, $scaffolderConfig), new FileToCompile(null, null));
33 }
34
35 36 37 38 39 40 41 42 43 44
45 protected function store($modelName, stdClass $scaffolderConfig, $compiled, FileToCompile $fileToCompile)
46 {
47 $path = PathParser::parse($scaffolderConfig->paths->views) . 'layouts/create.blade.php';
48
49 File::put($path, $compiled);
50
51 return $path;
52 }
53 }
54