Issues (73)

src/Providers/ChuckTemplateServiceProvider.php (1 issue)

Labels
Severity
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
The type Chuckbe\Chuckcms\Providers\Exception was not found. Did you mean Exception? If so, make sure to prefix the type with \.
Loading history...
31
            }
32
33
            return new \Chuckbe\Chuckcms\Chuck\Accessors\Template($template->slug);
34
        });
35
    }
36
}
37