我很好奇,我正在使用Laravel和Artisan进行我的迁移.是否有一种将信息输出到控制台的方法.我似乎找不到任何有关这方面的信息.例如:
<?PHP
class Generate_Sample_Users{
public function up(){
//Echo to console here
echo "Creating sample users...";
$generator = new Sample_Data();
$user_count = 30;
$users = array();
for($i=0; $i < $user_count; $i++){
array_push($users,$generator->generate_user($i));
}
DB::table('users')->insert($users);
}
public function down(){
DB::table('users')->delete();
}
}
不知道你是否使用Laravel 3或Laravel 4,如果它也可能在Laravel 3,但我发现这在
the docs.
$this->info('Creating sample users...');
编辑
如果切换到database seeds,您可以使用它来显示消息
$this->command->info('Creating sample users...');