Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update laravel/index.md file #2036

Open
wants to merge 4 commits into
base: 4.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions laravel/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,7 @@ use ApiPlatform\Metadata\Get;
#[Get(uriTemplate: '/my_custom_book/{id}')]
class Book
{
public string $id;
public string $title;
public function __construct(public string $id, public string $title) {}
}
```

Expand Down Expand Up @@ -224,6 +223,7 @@ namespace App\State;
use ApiPlatform\Metadata\Operation;
use ApiPlatform\State\ProviderInterface;
use App\Models\Book as BookModel;
use App\ApiResource\Book;

final class BookProvider implements ProviderInterface
{
Expand All @@ -242,6 +242,8 @@ Register the state provider:

namespace App\Providers;

use App\State\BookProvider;
+use ApiPlatform\State\ProviderInterface;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Support\ServiceProvider;

Expand Down Expand Up @@ -271,8 +273,7 @@ use App\State\BookProvider;
#[Get(uriTemplate: '/my_custom_book/{id}', provider: BookProvider::class)]
class Book
{
public string $id;
public string $title;
public function __construct(public string $id, public string $title) {}
}
```

Expand Down Expand Up @@ -624,6 +625,7 @@ API Platform provides an easy shortcut to some [useful filters](./filters.md), f
namespace App\Models;

use ApiPlatform\Metadata\ApiResource;
+use ApiPlatform\Metadata\QueryParameter;
+use ApiPlatform\Laravel\Eloquent\Filter\PartialSearchFilter;
use Illuminate\Database\Eloquent\Model;

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

use ApiPlatform\Metadata\ApiResource;
+use ApiPlatform\Metadata\QueryParameter;
+use ApiPlatform\Laravel\Eloquent\Filter\PartialSearchFilter;
+use ApiPlatform\Laravel\Eloquent\Filter\OrderFilter;
use Illuminate\Database\Eloquent\Model;
Expand Down