Courses

[NEW] Vue.js 3 + Laravel 11 + Vite: SPA CRUD

In this lesson, let's show a column from the relationship in the posts table. We will add a category for every post.

finished category relation


First, we need to create a Category model and migration.

php artisan make:model Category -m

database/migrations/xxxx_create_categories_table.php:

public function up(): void
{
Schema::create('categories', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->timestamps();
});
}

app/Models/Category.php:

class Category extends Model
{
protected $fillable = [
'name',
];
}

Next, we need to create a migration...

This lesson is only for Premium Members.
Want to access all lessons of this course?

You also get:

  • 58 courses (1056 lessons, 44 h 09 min total)
  • Premium tutorials
  • Access to repositories
  • Private Discord