以及这个教程:http://laravelbook.com/laravel-database-seeding/
但是,当我尝试运行php artisan db:seed
时,没有任何反应。
我尝试了这个:
<?php
// app/database/seeds/groups.php
return array(
'table' => 'groups',
array(
'name' => 'Administrador',
'description' => '<p>Permissão total no sistema</p>',
'created_at' => new DateTime,
'updated_at' => new DateTime
),
array(
'name' => 'Moderadores',
'description' => '<p>Podem apenas postar e moderar comentários</p>',
'created_at' => new DateTime,
'updated_at' => new DateTime
)
);
接下来执行命令:php artisan db:seed
。
php artisan db:seed --env=local
Database seeded!
但是:
mysql> select * from groups;
Empty set (0.00 sec)
DB::table('users')->delete();
是不可取的。 - Kevin