mirror of https://github.com/4xmen/xshop.git
Compare commits
No commits in common. 'f5a2f3dc67ffe362e81d4afad506a05c87d32784' and '2a7714845bb7b1d6a25e69ff907b83b29458a557' have entirely different histories.
f5a2f3dc67
...
2a7714845b
@ -1,48 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class SeedImageAll extends Command
|
||||
{
|
||||
|
||||
|
||||
public $models = ['Category', 'Group', 'Slider', 'Post', 'Product'];
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'seeding:all {directory}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
//
|
||||
foreach ($this->models as $model) {
|
||||
// Call the seeder command
|
||||
$exitCode = \Artisan::call('seeding:image', ['directory' => $this->argument('directory'), 'model' => $model]);
|
||||
|
||||
// Get the output
|
||||
$output = \Artisan::output();
|
||||
|
||||
// Handle the exit code and output as needed
|
||||
if ($exitCode === 0) {
|
||||
$this->info( "Seeding was successful: [$model] \n");
|
||||
} else {
|
||||
$this->error("Seeding failed with exit code {$exitCode}:\n");
|
||||
}
|
||||
$this->info( $output);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue