1 | <?php |
||
10 | class BlogServiceProvider extends ServiceProvider |
||
11 | { |
||
12 | /** |
||
13 | * All of the event / listener mappings. |
||
14 | * |
||
15 | * @var array |
||
16 | */ |
||
17 | protected $events = [ |
||
18 | \Chriscreates\Blog\Events\PostViewed::class => [ |
||
19 | \Chriscreates\Blog\Listeners\StoreViewData::class, |
||
20 | ], |
||
21 | ]; |
||
22 | |||
23 | /** |
||
24 | * Bootstrap the application services. |
||
25 | */ |
||
26 | public function boot() |
||
33 | |||
34 | /** |
||
35 | * Register bindings in the container. |
||
36 | * |
||
37 | * @return void |
||
38 | */ |
||
39 | public function register() |
||
44 | |||
45 | /** |
||
46 | * Register the events and listeners. |
||
47 | * |
||
48 | * @return void |
||
49 | * @throws BindingResolutionException |
||
50 | */ |
||
51 | private function handleEvents() |
||
61 | |||
62 | /** |
||
63 | * Register the package routes. |
||
64 | * |
||
65 | * @return void |
||
66 | */ |
||
67 | private function handleRoutes() |
||
73 | |||
74 | /** |
||
75 | * Get the Blog route group configuration array. |
||
76 | * |
||
77 | * @return array |
||
78 | */ |
||
79 | private function routeConfiguration() |
||
80 | { |
||
81 | return [ |
||
82 | 'namespace' => 'Blog\Http\Controllers', |
||
83 | 'prefix' => config('blog.path'), |
||
84 | 'middleware' => config('blog.middleware'), |
||
85 | ]; |
||
86 | } |
||
87 | |||
88 | /** |
||
89 | * Register the package's migrations. |
||
90 | * |
||
91 | * @return void |
||
92 | */ |
||
93 | private function handleMigrations() |
||
94 | { |
||
95 | if ($this->app->runningInConsole()) { |
||
96 | $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); |
||
97 | } |
||
98 | } |
||
99 | |||
100 | /** |
||
101 | * Register the package's publishable resources. |
||
102 | * |
||
103 | * @return void |
||
104 | */ |
||
105 | private function handlePublishing() |
||
106 | { |
||
107 | if ($this->app->runningInConsole()) { |
||
108 | $this->publishes([ |
||
109 | __DIR__.'/../public/' => public_path('vendor/blog'), |
||
110 | ], 'blog-assets'); |
||
111 | |||
112 | $this->publishes([ |
||
113 | __DIR__.'/../resources/views/' => resource_path('views'), |
||
114 | ], 'blog-views'); |
||
115 | |||
116 | $this->publishes([ |
||
117 | __DIR__.'/../database/factories/' => database_path('factories'), |
||
118 | ], 'blog-factories'); |
||
119 | |||
120 | $this->publishes([ |
||
121 | __DIR__.'/../config/blog.php' => config_path('blog.php'), |
||
122 | ], 'blog-config'); |
||
123 | } |
||
124 | } |
||
125 | |||
126 | /** |
||
127 | * @return void |
||
128 | */ |
||
129 | private function handleConfig() |
||
136 | |||
137 | /** |
||
138 | * @return void |
||
139 | */ |
||
140 | private function handleCommands() |
||
147 | } |
||
148 |