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 - Laravel Tutorial
From the course: Building a Website with Laravel, React.js, and Inertia
Creating a Post resource
- [Instructor] Let's create our post resource. Remember, we are not building an API now, so we will not need to use the dash dash API flag like we did earlier in the course. In fact, we will just run PHP artisan make model post dash A and press Enter. Laravel created all files that we need plus one that we will not need, the post policy. Again, we won't be using policy in this course as this is beyond the scope of what we are trying to demonstrate here. Let's update the migrations file. Everything we are going to do in this lesson we have already done in the Laravel API lessons, so the best way is to copy everything over as it's going to be exactly the same. (computer keys clicking) Let's add author, title, and body to the post table. Next, let's add the fillable fields to the post model. Create a factor and a seeder to seed our database with some fake posts. (computer keys clicking) Let's run the migration now. (computer keys clicking) And let's see the database. (computer keys…
Contents
-
-
-
-
-
(Locked)
Introduction to Inertia.js1m 16s
-
(Locked)
Getting started with a new Inertia project1m 58s
-
(Locked)
Creating a Post resource2m 29s
-
(Locked)
Creating the Home and About pages2m 14s
-
Creating an Inertia navigation2m 6s
-
(Locked)
Changing the website title2m 4s
-
(Locked)
Displaying posts3m 4s
-
(Locked)
Creating posts4m 37s
-
(Locked)
Displaying a single post1m 29s
-
(Locked)
Updating posts1m 51s
-
(Locked)
Deleting posts1m 33s
-
(Locked)
Challenge: Show a flash message1m 2s
-
(Locked)
Solution: Show a flash message2m 59s
-
(Locked)
-