I've wrote a bunch of text and then realised that it is better to delete everything and just point you to the video https://laracasts.com/series/whats-new-in-laravel-5-5/episodes/20
How to structure an API
Hi,
I am trying to write my first API and am looking for some guidance on how to structure this in Laravel. I have Passport install and have created access token for the Authorization Grant Code and Personal Access Token Flows.
I had initially thought i would just put in the API endpoint routes into the routes/api.php file and then call a Controller i had setup for the API endpoint which would use an existing Model. However, i see that Laravel comes with Eloquent API resources and after having a read of the documentation i am not sure of the benefits of doing it this way as opposed to how i initially thought i would go about it. Can someone explain the advantages of doing this with Laravel Eloquent API resources?
Thanks
Please or to participate in this conversation.