-
-
Notifications
You must be signed in to change notification settings - Fork 211
Expand file tree
/
Copy pathSeedDatabaseCommand.php
More file actions
36 lines (28 loc) · 1.18 KB
/
SeedDatabaseCommand.php
File metadata and controls
36 lines (28 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
namespace Native\Desktop\Commands;
use Illuminate\Database\Console\Seeds\SeedCommand as BaseSeedCommand;
use Native\Desktop\NativeServiceProvider;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
#[AsCommand(
name: 'native:seed',
description: 'Seed the database in the NativePHP development environment',
)]
class SeedDatabaseCommand extends BaseSeedCommand
{
protected $signature = 'native:seed';
protected function configure(): void
{
parent::configure();
$this->addArgument('class', mode: InputArgument::OPTIONAL, description: 'The class name of the root seeder');
$this->addOption('class', mode: InputOption::VALUE_OPTIONAL, description: 'The class name of the root seeder', default: 'Database\\Seeders\\DatabaseSeeder');
}
public function handle()
{
// Add the database option here so it won't show up in `--help`
$this->addOption('database', mode: InputOption::VALUE_REQUIRED, default: 'nativephp');
(new NativeServiceProvider($this->laravel))->rewriteDatabase();
return parent::handle();
}
}