How to seed database in Laravel (Jetstream, Inertiajs, MAMP)

Опубликовано: 11 Октябрь 2024
на канале: codingoblin
162
3

How to use seeders in Laravel to seed your database.

This setup is using Laravel Jetstream with Inertia.js.

How to seed your database in Laravel using Laravel Jetstream, Inertia.js, and localhost using MAMP.

See written instructions at https://codingoblin.com/seeding-datab...

Seeding your database in your Laravel application can be very useful. Database seeding is the process of programatically filling your database with data. It is commonly done during development to give your application dummy data to work with, or to insert data that you will always want in your database such as a specific set of users.

What we are going to do
In this guide we are going to seed our Laravel database with an initial set of users. We are going to create 2 users, one called Admin and one called John. These initial users won’t have any specific roles or permissions assigned to them, this will be looked at in the next guide. For now we are just going to show how to create the users using a Laravel seeder.