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