Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
ViewServiceProvider
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 boot
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace App\Providers;
4
5use Illuminate\Pagination\Paginator;
6use Illuminate\Support\Facades\Cache;
7use Illuminate\Support\Facades\File;
8use Illuminate\Support\Facades\View;
9use Illuminate\Support\ServiceProvider;
10
11class 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}