api-platform / core

The server component of API Platform: hypermedia and GraphQL APIs in minutes
https://api-platform.com
MIT License
2.42k stars 863 forks source link

feat(laravel): provide a trait in addition to the annotation #6543

Closed dunglas closed 1 month ago

dunglas commented 1 month ago
Q A
Branch? main
Tickets n/a
License MIT
Doc PR n/a

Provide a more idiomatic way to mark an Eloquent model as an ApiResource (annotations still work!):

namespace App\Models;

use ApiPlatform\Laravel\IsApiResource;
use Illuminate\Database\Eloquent\Model;

class Author extends Model
{
    use IsApiResource;
}