gestione gare pubbliche
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 

51 righe
1.4 KiB

<?php
namespace App\Console\Commands\Database\Tenant;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;
class MakeCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'tenantdb:make {name : The name of the migration}
{--create= : The table to be created}
{--table= : The table to migrate}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Create a new migration file for tenants\' database';
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$options = ['name' => $this->argument('name')];
$options['--path'] = 'database/migrations/tenant';
if(! empty($this->option('create'))) { $options['--create'] = $this->option('create'); }
if(! empty($this->option('table'))) { $options['--table'] = $this->option('table'); }
try {
if(! File::exists($options['--path'])) { File::makeDirectory($options['--path'], 0755, true); }
$this->call('make:migration', $options);
$this->info('Migration created into database/migrations/tenant');
} catch (\Throwable $th) {
$this->error('Something went wrong!');
dd($th);
}
}
}