sarala-io /
sarala-laravel
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace Sarala; |
||||
| 4 | |||||
| 5 | use Illuminate\Http\Request; |
||||
| 6 | use Illuminate\Support\ServiceProvider; |
||||
| 7 | use League\Fractal\Manager; |
||||
| 8 | use League\Fractal\Serializer\DataArraySerializer; |
||||
| 9 | use League\Fractal\Serializer\JsonApiSerializer; |
||||
| 10 | use Sarala\Query\Fields; |
||||
| 11 | use Sarala\Query\QueryParamBag; |
||||
| 12 | use Sarala\Query\Sorts; |
||||
| 13 | |||||
| 14 | class SaralaServiceProvider extends ServiceProvider |
||||
| 15 | { |
||||
| 16 | public function boot() |
||||
| 17 | { |
||||
| 18 | $this->publishes([ |
||||
| 19 | __DIR__.'/../config/sarala.php' => config_path('sarala.php'), |
||||
| 20 | ], 'config'); |
||||
| 21 | |||||
| 22 | Request::macro('filters', fn () => new QueryParamBag($this, 'filter')); |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 23 | Request::macro('includes', fn () => new QueryParamBag($this, 'include')); |
||||
|
0 ignored issues
–
show
$this of type Sarala\SaralaServiceProvider is incompatible with the type Illuminate\Http\Request expected by parameter $request of Sarala\Query\QueryParamBag::__construct().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 24 | Request::macro('fields', fn () => resolve(Fields::class)); |
||||
| 25 | Request::macro('sorts', fn () => new Sorts($this)); |
||||
|
0 ignored issues
–
show
$this of type Sarala\SaralaServiceProvider is incompatible with the type Illuminate\Http\Request expected by parameter $request of Sarala\Query\Sorts::__construct().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 26 | Request::macro('allowedIncludes', fn () => []); |
||||
| 27 | } |
||||
| 28 | |||||
| 29 | public function register(): void |
||||
| 30 | { |
||||
| 31 | $this->app->singleton(Sarala::class, Sarala::class); |
||||
| 32 | $this->app->bind(JsonApiSerializer::class, fn () => new JsonApiSerializer(config('sarala.base_url'))); |
||||
| 33 | $this->app->bind(DataArraySerializer::class, DataArraySerializer::class); |
||||
| 34 | $this->app->singleton(Fields::class, Fields::class); |
||||
| 35 | $this->app->bind(Manager::class, fn ($app) => (new Manager())->setSerializer($app->make(Sarala::class)->getSerializer())); |
||||
| 36 | } |
||||
| 37 | } |
||||
| 38 |