From the course: Building a Website with Laravel, React.js, and Inertia

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Creating a Post resource

Creating a Post resource

- [Instructor] Let's create our post resource. To do that, I'll run PHP Artisan Make Model post dash a dash dash API in the terminal. By the way, I've aliased PHP Artisan to Art, so I'll be using art to run artisan commands. It's just a little bit shorter. This dash a flag tells Laravel to create the model factory migration seeder form request, controller, and policy. We won't be needing the policy in this course, but it's easier to delete a file than run multiple commands. So I decided to simply use the dash a flag. This dash dash API flag tells Laravel to create an API resource controller. That does not include the create or edit methods. Let's start with creating the post route in the API dot PHP file. That's all we need to do in here. If you wanted to know what endpoints have been created for us, run PHP Artisan Route List in the terminal. And these are all our endpoints. We are going to update the post migration now. Let's think about it, what is our blog going to need? We will…

Contents