#All of them
php artisan db:seed
#One class
php artisan db:seed --class=UserSeeder
php artisan db:seed --class=UserSeeder
php artisan migrate:fresh --seed
//All Seeders
php artisan db:seed
//One Seeder
php artisan db:seed --class=NameSeeder
php artisan make:seeder UsersTableSeeder
#To create a seeder
php artisan make:seeder CategorySeeder
$ php artisan make:seeder MoviesTableSeeder
let's see simple example:
you can use following command to all seeders in laravel application:
***************************
php artisan db:seed
***************************
you have to register all seeder in DatabaseSeeder.php file and that will run all seeders at a time, register as like bellow:
database/seeders/DatabaseSeeder.php
<?php
namespace DatabaseSeeders;
use IlluminateDatabaseSeeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/
public function run()
{
$this->call([
UserSeeder::class
AdminSeeder::class
]);
}
}
php artisan db:seed
php artisan db:seed --class=UserSeeder
make DatabaseSeerder class and call function with seeder Array
<?php
namespace DatabaseSeeders;
use IlluminateDatabaseSeeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/
public function run()
{
$this->call([
UserSeeder::class
AdminSeeder::class
]);
}
}
$ php artisan db:seed