In this tutorial, we’ll learn what Laravel API Resources are, and how to use them in our Laravel project. We are going to create a user and post API resource in this project example.
For more, you can go and read the Laravel documentation about API resources.
Create User Resource
Resources are created on top of an eloquent model. So this means that we need to create a resource for every eloquent model separately.
To create a resource we need to run the following command on the terminal.
php artisan make:resource UserResource
Read more at blog.laraveller.com