- Create a seeder php artisan make:seeder seederName
- This creates a file seederNameindatabase/seeds
- You can use a model or default database class. I’ll show you both examples
- To use an existing model, try this approach
// assumes you've already added "use App\User" and "use Illuminate\Support\Facades\Hash;" at top of your file
$user = User::create([
          'name' => 'Saqib',
          'email' => 'saqib@saqib.com',
          'password' => Hash::make('password'),
          'level' => 1
        ]);
- If you don’t have a model and want to run database inserts, try something like this
DB::table('users')->insert([
        'name' => 'Jon Snow',
        'email' => 'saqib@test.com',
        'password' => Hash::make('password')
      ]);
- Run php artisan db:seedorphp artisan migrate:fresh --seedto run seeders