1 <?php
2
3 namespace Scaffolder;
4
5 use Illuminate\Support\ServiceProvider;
6 use Scaffolder\Commands\ClearCacheCommand;
7 use Scaffolder\Commands\GeneratorCommand;
8 use Scaffolder\Commands\InitializeApiCommand;
9
10 class ScaffolderServiceProvider extends ServiceProvider
11 {
12 13 14
15 public function boot()
16 {
17
18 $this->publishes([
19 __DIR__ . '/../../config/' => base_path('scaffolder-config/')
20 ], 'config');
21
22
23 $this->loadViewsFrom(__DIR__ . '/../../views', 'scaffolder');
24
25
26 if (!$this->app->routesAreCached())
27 {
28 require __DIR__ . '/../../routes/generator.php';
29 }
30 }
31
32 33 34 35
36 public function register()
37 {
38 $this->app->singleton('scaffolder.command.generate', function ($app)
39 {
40 return new GeneratorCommand($app['scaffolder.theme.views'], $app['scaffolder.theme.layouts'], $app['scaffolder.theme.extension'], $app->tagged('scaffolder.extension'));
41 });
42
43 $this->app->singleton('scaffolder.command.cache.clear', function ()
44 {
45 return new ClearCacheCommand();
46 });
47
48 $this->app->singleton('scaffolder.command.api.initialize', function ()
49 {
50 return new InitializeApiCommand();
51 });
52
53 $this->commands([
54 'scaffolder.command.generate',
55 'scaffolder.command.cache.clear',
56 'scaffolder.command.api.initialize'
57 ]);
58 }
59 }
60