/ModelMakeCommand.php Secret
Created
March 3, 2019 01:31
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
<?php | |
namespace App\Console\Commands; | |
use Illuminate\Foundation\Console\ModelMakeCommand as BaseCommand; | |
use Illuminate\Support\Str; | |
class ModelMakeCommand extends BaseCommand | |
{ | |
/** | |
* Create a migration file for the model. | |
* | |
* @return void | |
*/ | |
protected function createMigration() | |
{ | |
$table = Str::snake(class_basename($this->argument('name'))); | |
if ($this->option('pivot')) { | |
$table = Str::singular($table); | |
} | |
$this->call('make:migration', [ | |
'name' => "create_{$table}_table", | |
'--create' => $table, | |
]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment