1 | <?php |
||
2 | |||
3 | namespace Chuckbe\Chuckcms\Providers; |
||
4 | |||
5 | use Chuckbe\Chuckcms\Models\Template as TemplateModel; |
||
6 | use Illuminate\Support\ServiceProvider; |
||
7 | |||
8 | class ChuckTemplateServiceProvider extends ServiceProvider |
||
9 | { |
||
10 | /** |
||
11 | * Bootstrap the application services. |
||
12 | * |
||
13 | * @return void |
||
14 | */ |
||
15 | public function boot() |
||
16 | { |
||
17 | // |
||
18 | } |
||
19 | |||
20 | /** |
||
21 | * Register the application services. |
||
22 | * |
||
23 | * @return void |
||
24 | */ |
||
25 | public function register() |
||
26 | { |
||
27 | $this->app->bind('ChuckTemplate', function () { |
||
28 | $template = TemplateModel::first(); |
||
29 | if ($template == null) { |
||
30 | throw new Exception('Whoops! No Template Defined...'); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
31 | } |
||
32 | |||
33 | return new \Chuckbe\Chuckcms\Chuck\Accessors\Template($template->slug); |
||
34 | }); |
||
35 | } |
||
36 | } |
||
37 |