私は10月にプラグインを持っています。私は必要なテーブルを作成し、ドキュメントごとにそれをシードします。テーブルのシードまたはマイグレーション時にコンソールに出力を提供するにはどうすればよいですか?
これを実行する際にコンソール出力を提供したいので、私が設定しているプロセスをデバッグすることができます。
php artisan october:up
の実行時に情報をコンソールに出力するにはどうすればよいですか? symfonyのクラスConsoleOutput
$output = new \Symfony\Component\Console\Output\ConsoleOutput(2);
$output->writeln('hello');
コンソールにこの意志の出力情報を使用することにより
use Db;
use Seeder;
class SeedGeoStateTable extends Seeder
{
public function run()
{
foreach(array_merge(glob(__DIR__.'/seed/geo_state/*.txt'), glob(__DIR__.'/seed/geo_state/*.json')) as $file) {
$this->insert($file);
gc_collect_cycles();
}
}
public function insert($file) {
// output to console which file i'm seeding here
$json = json_decode(file_get_contents($file),true);
foreach($json as $entry) {
Db::table("geo_state")->insert($entry);
}
}
}
あなたは 'echo'を試してみましたか? – Wreigh