1 <?php
2
3 namespace Scaffolder\Compilers\View;
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 WelcomeViewCompiler 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 $this->stub = $themeExtension->runAfterWelcomeViewIsCompiled($this->stub, $scaffolderConfig);
33
34 foreach ($extensions as $extension)
35 {
36 $this->stub = $extension->runAfterWelcomeViewIsCompiled($this->stub, $scaffolderConfig);
37 }
38
39 return $this->store(null, $scaffolderConfig, $this->stub, new FileToCompile(null, null));
40 }
41
42 43 44 45 46 47 48 49 50 51
52 protected function store($modelName, stdClass $scaffolderConfig, $compiled, FileToCompile $fileToCompile)
53 {
54 $path = PathParser::parse($scaffolderConfig->paths->views) . 'welcome.blade.php';
55
56 File::put($path, $compiled);
57
58 return $path;
59 }
60 }
61