Answer the question
In order to leave comments, you need to log in
How to do data seeding (Database: Seeding) in the database?
Initial data:
PHP 7.2.20
Laravel 5.7.28
1. I run the php artisan make:seeder RolesTableSeeder command
2. The database/seeds/RolesTableSeeder.php file is created
use Illuminate\Database\Seeder;
class RolesTableSeeder extends Seeder
{
public function run()
{
//Метод run специально оставляю пустым, чтобы легче было дебажить
}
}
Answer the question
In order to leave comments, you need to log in
php artisan db:seed runs the database\seeds\DatabaseSeeder.php file that comes out of the box.
<?php
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
public function run()
{
$this->call(RolesTableSeeder::class);
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question