We have the database tables and fields ready thanks to migrations. We also have the means to create fake data thanks to model factories.
The only thing left to do is to create our fake data. Here are the quick commands to get data into the database:
// database/seeds/DatabaseSeeder.php // clear the database DB::table('users')->delete(); DB::table('posts')->delete(); // fill the database // the post model factory will create a new user/author for each post factory(App\Post::class, 8)->create();
Then we can run the seeder with
php artisan db:seed.
Table of Contents
You'll be able to see the new posts and users in your database!