1 | <?php |
||
8 | class AppServiceProvider extends ServiceProvider |
||
9 | { |
||
10 | /** |
||
11 | * Bootstrap any application services. |
||
12 | */ |
||
13 | 1 | public function boot() |
|
17 | |||
18 | /** |
||
19 | * Register any application services. |
||
20 | */ |
||
21 | 1 | public function register() |
|
22 | { |
||
23 | 1 | if (is_domain('admin')) { |
|
24 | $this->registerServices($this->getProvidersForAdminSite()); |
||
25 | } |
||
26 | |||
27 | 1 | if (is_domain('api')) { |
|
28 | $this->addAcceptableJsonType(); |
||
29 | } |
||
30 | 1 | } |
|
31 | |||
32 | /** |
||
33 | * Register services. |
||
34 | * |
||
35 | * @param string|array $services |
||
36 | */ |
||
37 | protected function registerServices($services) |
||
41 | |||
42 | /** |
||
43 | * Get the services provided for admin site. |
||
44 | * |
||
45 | * @return array |
||
46 | */ |
||
47 | protected function getProvidersForAdminSite() |
||
53 | |||
54 | /** |
||
55 | * Add "application/json" to the "Accept" header for the current request, |
||
56 | * it will make `$request->expectsJson()` return true. |
||
57 | */ |
||
58 | protected function addAcceptableJsonType() |
||
69 | } |
||
70 |