Hi,This post will give you example of laravel 8 run one seed. you can understand a concept of laravel 8 artisan run specific seeder. We will look at example of laravel 8 run single seed. if you have question about how to run specific seeder in laravel 8 then i will give simple example with solution. Alright, let’s dive into the steps.
Here, i will give you simple example of how to run specific seeder file in laravel. you can easily use this example with laravel 6, laravel 7 and laravel 8 version.
let's see simple example:
Run Specific Seeder
you can use following command to run specific seeder in laravel application:
php artisan db:seed --class=AdminSeeder
Your seeder code as like here:
class AdminSeeder extends Seeder
* Run the database seeds.
* @return void
public function run()
"name" => "Hardik Savani",
"email" => "email@example.com",
"password" => bcrypt("123456")
Run All Seeder
you can use following command to run all seeder in laravel application:
php artisan db:seed
Run Migration with Seeder
you can use following command to run migrate with seeder in laravel application:
php artisan migrate:fresh --seed
Run Force Seeder
you can use following command to run force seeder for production in laravel application:
php artisan db:seed --force
php artisan db:seed --class=AdminSeeder --force
I hope it can help you...
Do you like below Tutorials ?
- Laravel generate random unique string example
- Laravel - chmod(storage/oauth-private.key): Operation failed: Operation not permitted
- Laravel 7.x and 6.x datatables example from scratch
- How to compress PNG image using pngquant in PHP?
- Laravel 7.x and 6.x Chart example using Charts Package
- Guzzle http client GET and POST request example in Laravel 5
- Laravel schema default current timestamp value example
- Laravel 7.x and 6.x Get Site URL Examples