Answers for "seed class laravel"

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
3

laravel db seed specific class

php artisan db:seed --class=UserSeeder
Posted by: Guest on August-24-2020
9

laravel make seeder

php artisan make:seeder NameOfTheSeeder
Posted by: Guest on May-15-2020
1

how to make db seeder in laravel

php artisan make:seeder UsersTableSeeder
Posted by: Guest on January-06-2021
1

laravel 8 seeding

<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;

class DatabaseSeeder extends Seeder
{
    /**
     * Run the database seeders.
     *
     * @return void
     */
    public function run()
    {
        DB::table('users')->insert([
            'name' => Str::random(10),
            'email' => Str::random(10).'@gmail.com',
            'password' => Hash::make('password'),
        ]);
    }
}
Posted by: Guest on December-04-2020
4

create migration model and seeder laravel at once

php artisan make:model MODEL_PATH\MODEL_NAME -ms
  
-m, --migration Create a new migration file for the model.
-s, --seeder Create a new seeder file for the model.
Posted by: Guest on June-28-2020

Browse Popular Code Answers by Language