[V1] Update 'migrations:export' message (#3470)

* Update command message

* Export migrations command improvements
This commit is contained in:
Benjamin Beganović 2020-03-10 22:11:31 +01:00 committed by GitHub
parent d9a3b5453a
commit 3f25b62ab6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,14 +17,14 @@ class ExportMigrations extends Command
* *
* @var string * @var string
*/ */
protected $signature = 'migrations:export'; protected $signature = 'migrations:export {--user=}';
/** /**
* The console command description. * The console command description.
* *
* @var string * @var string
*/ */
protected $description = 'Export account migrations to folder'; protected $description = 'Export account migrations to folder.';
/** /**
* Create a new command instance. * Create a new command instance.
@ -43,7 +43,22 @@ class ExportMigrations extends Command
*/ */
public function handle() public function handle()
{ {
foreach (User::all() as $user) { $this->info('Note: Migrations will be stored inside of (storage/migrations) folder.');
if($this->option('user')) {
$record = User::findOrFail($this->option('user'));
return $this->export($record);
}
$users = User::all();
foreach($users as $user) {
$this->export($user);
}
}
private function export($user)
{
$this->account = $user->account; $this->account = $user->account;
$date = date('Y-m-d'); $date = date('Y-m-d');
@ -78,4 +93,3 @@ class ExportMigrations extends Command
$this->info('User with id #' . $user->id . ' exported.'); $this->info('User with id #' . $user->id . ' exported.');
} }
} }
}