Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
77.78% |
7 / 9 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| AppServiceProvider | |
77.78% |
7 / 9 |
|
50.00% |
1 / 2 |
2.04 | |
0.00% |
0 / 1 |
| register | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| boot | |
75.00% |
6 / 8 |
|
0.00% |
0 / 1 |
1.02 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Providers; |
| 4 | |
| 5 | use App\Audit\QueryAuditor; |
| 6 | use Dedoc\Scramble\Scramble; |
| 7 | use Illuminate\Http\Resources\Json\JsonResource; |
| 8 | use Illuminate\Routing\Route; |
| 9 | use Illuminate\Support\Facades\Gate; |
| 10 | use Illuminate\Support\ServiceProvider; |
| 11 | use Illuminate\Support\Str; |
| 12 | |
| 13 | class AppServiceProvider extends ServiceProvider |
| 14 | { |
| 15 | /** |
| 16 | * Register any application services. |
| 17 | */ |
| 18 | #[\Override] |
| 19 | public function register(): void |
| 20 | { |
| 21 | // |
| 22 | } |
| 23 | |
| 24 | /** |
| 25 | * Bootstrap any application services. |
| 26 | */ |
| 27 | public function boot(): void |
| 28 | { |
| 29 | JsonResource::withoutWrapping(); |
| 30 | |
| 31 | Gate::define('viewApiDocs', function () { |
| 32 | return app()->environment('local'); |
| 33 | }); |
| 34 | |
| 35 | Scramble::configure()->routes(function (Route $route) { |
| 36 | return Str::startsWith($route->uri, 'api/'); |
| 37 | }); |
| 38 | |
| 39 | (new QueryAuditor())->register(); |
| 40 | } |
| 41 | } |