Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| ViewServiceProvider | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| boot | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Providers; |
| 4 | |
| 5 | use Illuminate\Pagination\Paginator; |
| 6 | use Illuminate\Support\Facades\Cache; |
| 7 | use Illuminate\Support\Facades\File; |
| 8 | use Illuminate\Support\Facades\View; |
| 9 | use Illuminate\Support\ServiceProvider; |
| 10 | |
| 11 | class ViewServiceProvider extends ServiceProvider |
| 12 | { |
| 13 | /** |
| 14 | * Bootstrap any application services. |
| 15 | * |
| 16 | * @return void |
| 17 | */ |
| 18 | public function boot(): void |
| 19 | { |
| 20 | // * Set default view of the paginator. |
| 21 | Paginator::defaultView('modules.pagination'); |
| 22 | |
| 23 | // * Shares this data with all views. |
| 24 | // Get data from composer.json. |
| 25 | $appInfos = Cache::remember('composer', 360, function () { |
| 26 | return json_decode(File::get(\app_path('../composer.json'))); |
| 27 | }); |
| 28 | View::share('name', $appInfos->name); |
| 29 | View::share('version', $appInfos->version); |
| 30 | View::share('license', $appInfos->license); |
| 31 | } |
| 32 | } |