BaseCommand.php
2 years ago
FreshCommand.php
3 weeks ago
InstallCommand.php
3 weeks ago
MigrateCommand.php
3 weeks ago
MigrateMakeCommand.php
3 weeks ago
RefreshCommand.php
2 years ago
ResetCommand.php
3 weeks ago
RollbackCommand.php
2 years ago
StatusCommand.php
3 weeks ago
TableGuesser.php
2 years ago
InstallCommand.php
61 lines
| 1 | <?php |
| 2 | |
| 3 | namespace IAWPSCOPED\Illuminate\Database\Console\Migrations; |
| 4 | |
| 5 | use IAWPSCOPED\Illuminate\Console\Command; |
| 6 | use IAWPSCOPED\Illuminate\Database\Migrations\MigrationRepositoryInterface; |
| 7 | use IAWPSCOPED\Symfony\Component\Console\Input\InputOption; |
| 8 | /** @internal */ |
| 9 | class InstallCommand extends Command |
| 10 | { |
| 11 | /** |
| 12 | * The console command name. |
| 13 | * |
| 14 | * @var string |
| 15 | */ |
| 16 | protected $name = 'migrate:install'; |
| 17 | /** |
| 18 | * The console command description. |
| 19 | * |
| 20 | * @var string |
| 21 | */ |
| 22 | protected $description = 'Create the migration repository'; |
| 23 | /** |
| 24 | * The repository instance. |
| 25 | * |
| 26 | * @var \Illuminate\Database\Migrations\MigrationRepositoryInterface |
| 27 | */ |
| 28 | protected $repository; |
| 29 | /** |
| 30 | * Create a new migration install command instance. |
| 31 | * |
| 32 | * @param \Illuminate\Database\Migrations\MigrationRepositoryInterface $repository |
| 33 | * @return void |
| 34 | */ |
| 35 | public function __construct(MigrationRepositoryInterface $repository) |
| 36 | { |
| 37 | parent::__construct(); |
| 38 | $this->repository = $repository; |
| 39 | } |
| 40 | /** |
| 41 | * Execute the console command. |
| 42 | * |
| 43 | * @return void |
| 44 | */ |
| 45 | public function handle() |
| 46 | { |
| 47 | $this->repository->setSource($this->input->getOption('database')); |
| 48 | $this->repository->createRepository(); |
| 49 | $this->components->info('Migration table created successfully.'); |
| 50 | } |
| 51 | /** |
| 52 | * Get the console command options. |
| 53 | * |
| 54 | * @return array |
| 55 | */ |
| 56 | protected function getOptions() |
| 57 | { |
| 58 | return [['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use']]; |
| 59 | } |
| 60 | } |
| 61 |