Answers for "laravel call command in database seeder"

PHP
21

laravel run seed

#All of them
php artisan db:seed
#One class
php artisan db:seed --class=UserSeeder
Posted by: Guest on May-08-2020
0

make php artisan db:seed working

class DatabaseSeeder extends Seeder
{
    public function run()
    {
        $this->call(ArticlesTableSeeder::class);
        $this->call(UsersTableSeeder::class);
    }
}
Posted by: Guest on July-07-2021
0

parameter to laravel seeder

class UsersTableSeeder extends Seeder
{
    public function run()
    {
        $limit = env('SEEDER_LIMIT', 1);

        echo $this->limit;
    }
}

//In terminal run:
SEEDER_LIMIT=10 php artisan db:seed --class=UsersTableSeeder
Posted by: Guest on May-16-2021

Code answers related to "laravel call command in database seeder"

Browse Popular Code Answers by Language