Laravel create db table

  • php artisan make:migration create_table
  • update newly created table with columns needed
  • php artisan migrate
  • generate seed
  • php artisan make:seeder TableSeeder
  • Add records to table
  DB::table('table')->insert([
		'name' => Str::random(10),
		'email' => Str::random(10).'@gmail.com',
		'password' => Hash::make('password'),
	]);
  • composer dump-autoload -o
  • php artisan db:seed --class=TableSeeder

Type::note Language:: PHP Framework::laravel