DEV Community

Cover image for Beginner’s Guide to Laravel API Resource
Code With Tony
Code With Tony

Posted on

Beginner’s Guide to Laravel API Resource

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.

Working with Laravel API Resource

For more, you can go and read the Laravel documentation about API resources.

Watch the video for more details.

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

Top comments (0)