. */ namespace App\Console\Commands\Accounts; use Database\Seeders\LiblinphoneTesterAccoutSeeder; use Illuminate\Console\Command; use Illuminate\Support\Facades\App; class Seed extends Command { protected $signature = 'accounts:seed {json-file-path}'; protected $description = 'Seed some accounts from a JSON file'; public function handle() { $file = $this->argument('json-file-path'); if (!file_exists($file)) { $this->info('The JSON file doesn\'t exists'); return Command::FAILURE; } $json = json_decode(file_get_contents($file)); if ($json == null || $json == false) { $this->info('Malformed JSON file'); return Command::FAILURE; } $seeder = App::make(LiblinphoneTesterAccoutSeeder::class); $seeder->run($json); return Command::SUCCESS; } }