2016-06-09 105 views
1

通常當播種我的數據庫時,它會告訴我在命令行播種的是哪張表,但是因爲我正在向播種機傳遞一個參數,所以消息已經消失(使得調試真的很難,因爲我不知道哪個當播種機破裂時播種機就開始播種)。Laravel播種輸出

use Illuminate\Database\Seeder; 
use Illuminate\Database\Eloquent\Model; 

class SeedTestLargeData extends Seeder 
{ 
    /** 
    * Run the database seeds. 
    * 
    * @return void 
    */ 
    public function run() 
    { 
     Model::unguard(); 

     // Default 

     $this->call(UsersSeeder::class, 'large_test_data'); 

     Model::reguard(); 
    } 

    public function call($class, $data_filename = null) { 
     $this->resolve($class)->run($data_filename); 
    } 
} 

任何有關如何找回它的想法?

回答

1

更改()調用方法是這樣的:

public function call($class, $data_filename = null) 
{ 
    $this->resolve($class)->run($data_filename); 

    if (isset($this->command)) { 
     $this->command->getOutput()->writeln("<info>Seeded:</info>".$class); 
    } 
} 
1

在原有Seedercall方法有一個額外的語句,嘗試添加它:

public function call($class) { 

    //... 

    if (isset($this->command)) { 
     $this->command->getOutput()->writeln("<info>Seeded:</info> $class"); 
    } 
}