This repository has been archived by the owner on Apr 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the lucid-console project. | ||
* | ||
* (c) Vinelab <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Lucid\Console\Commands; | ||
|
||
use Illuminate\Support\Facades\Artisan; | ||
use Lucid\Console\Command; | ||
use Lucid\Console\Finder; | ||
use Symfony\Component\Console\Command\Command as SymfonyCommand; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
|
||
/** | ||
* @author Abed Halawi <[email protected]> | ||
*/ | ||
class MigrationMakeCommand extends SymfonyCommand | ||
{ | ||
use Finder; | ||
use Command; | ||
|
||
/** | ||
* The console command name. | ||
* | ||
* @var string | ||
*/ | ||
protected $name = 'make:migration'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Create a new Migration class in a service'; | ||
|
||
/** | ||
* Execute the console command. | ||
*/ | ||
public function handle() | ||
{ | ||
$service = $this->argument('service'); | ||
$migration = $this->argument('migration'); | ||
|
||
$path = $this->relativeFromReal($this->findServicePath($service) . "/database/migrations"); | ||
|
||
$output = shell_exec('php artisan make:migration '.$migration.' --path='.$path); | ||
|
||
$this->info($output); | ||
$this->info("\n".'Find it at <comment>'.$path.'</comment>'."\n"); | ||
} | ||
|
||
/** | ||
* Get the console command arguments. | ||
* | ||
* @return array | ||
*/ | ||
protected function getArguments() | ||
{ | ||
return [ | ||
['migration', InputArgument::REQUIRED, 'The migration\'s name.'], | ||
['service', InputArgument::REQUIRED, 'The service in which the migration should be generated.'], | ||
]; | ||
} | ||
} |