thinktomorrow /
chief
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Thinktomorrow\Chief\App\Console; |
||
| 4 | |||
| 5 | class RefreshDatabase extends BaseCommand |
||
| 6 | { |
||
| 7 | protected $signature = 'chief:scaffold {--reset}'; |
||
| 8 | protected $description = 'This will scaffold a few records to get started for development.'; |
||
| 9 | |||
| 10 | /** |
||
| 11 | * @return void |
||
| 12 | */ |
||
| 13 | public function handle() |
||
| 14 | { |
||
| 15 | if (app()->environment() != 'local') { |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 16 | throw new \Exception('Aborting. This command is dangerous and only meant for your local environment.'); |
||
| 17 | } |
||
| 18 | |||
| 19 | if ($this->option('reset')) { |
||
| 20 | if (! $this->confirm('You are about to force reset the database in the ' . app()->environment() . ' environment! ARE YOU SURE?')) { |
||
| 21 | $this->info('aborting.'); |
||
| 22 | |||
| 23 | return; |
||
| 24 | } |
||
| 25 | } |
||
| 26 | |||
| 27 | // loop over all managed models |
||
| 28 | |||
| 29 | // reset entries if requested |
||
| 30 | |||
| 31 | // Add 10 dummy entries + make sure to enter page fragments as well. |
||
| 32 | |||
| 33 | // Include Our Chief factories for this command |
||
| 34 | // app(ModelFactory::class)->load(realpath(dirname(__DIR__) . '/../database/factories')); |
||
| 35 | // |
||
| 36 | // $this->info('Scaffolding some entries...'); |
||
| 37 | // factory(Page::class, 5)->create(); |
||
| 38 | |||
| 39 | $this->info('Great. We\'re done here. NOW START HACKING!'); |
||
| 40 | } |
||
| 41 | } |
||
| 42 |