Skip to content

Commit dfbd829

Browse files
authored
Update laravel/index.md file
- Added missing 'use' statements in the laravel/index.md for clarity - Fixed a typo in a Model usage - Corrected 'ProviderInterface::class' to 'provider' in ApiServiceProvider
1 parent d4ac684 commit dfbd829

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

laravel/index.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ final class BookProvider implements ProviderInterface
230230
public function provide(Operation $operation, array $uriVariables = [], array $context = []): object|array|null
231231
{
232232
$book = BookModel::find($uriVariables['id']);
233-
return new Book(id: $book->id, title: $book->title);
233+
return new BookModel(id: $book->id, title: $book->title);
234234
}
235235
}
236236
```
@@ -242,6 +242,7 @@ Register the state provider:
242242

243243
namespace App\Providers;
244244

245+
use App\State\BookProvider;
245246
use Illuminate\Contracts\Foundation\Application;
246247
use Illuminate\Support\ServiceProvider;
247248

@@ -253,7 +254,7 @@ class ApiServiceProvider extends ServiceProvider
253254
return new BookProvider();
254255
});
255256

256-
$this->app->tag([BookProvider::class], ProviderInterface::class);
257+
$this->app->tag([BookProvider::class], 'provider');
257258
}
258259
}
259260
```
@@ -624,6 +625,7 @@ API Platform provides an easy shortcut to some [useful filters](./filters.md), f
624625
namespace App\Models;
625626

626627
use ApiPlatform\Metadata\ApiResource;
628+
+use ApiPlatform\Metadata\QueryParameter;
627629
+use ApiPlatform\Laravel\Eloquent\Filter\PartialSearchFilter;
628630
use Illuminate\Database\Eloquent\Model;
629631

@@ -643,6 +645,7 @@ It's also possible to enable filters on every exposed property:
643645
namespace App\Models;
644646

645647
use ApiPlatform\Metadata\ApiResource;
648+
+use ApiPlatform\Metadata\QueryParameter;
646649
+use ApiPlatform\Laravel\Eloquent\Filter\PartialSearchFilter;
647650
+use ApiPlatform\Laravel\Eloquent\Filter\OrderFilter;
648651
use Illuminate\Database\Eloquent\Model;

0 commit comments

Comments
 (0)