DEV Community

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

Posted on

1 1

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)

nextjs tutorial video

Youtube Tutorial Series 📺

So you built a Next.js app, but you need a clear view of the entire operation flow to be able to identify performance bottlenecks before you launch. But how do you get started? Get the essentials on tracing for Next.js from @nikolovlazar in this video series 👀

Watch the Youtube series

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay