1) Edit "DatabaseSeeder.php" under
database/seeds
in the project directory. 2) Uncomment the following line:
$this->call('UserTableSeeder');
3) Add the following block of code:
use App\User;
class UserTableSeeder extends Seeder {
public function run()
{
DB::table('users')->delete();
User::create(array(
'name' => 'admin',
'email' => 'admin@test.com',
'password' => Hash::make('password')
));
}
}
4) Run the following command to add data to the user table.
php artisan db:seed
沒有留言:
張貼留言