Skip to content

Instantly share code, notes, and snippets.

@LespiletteMaxime
Forked from browner12/MakeAllCommand.php
Created December 18, 2016 12:27
Show Gist options
  • Save LespiletteMaxime/aaaea7c8319163914e89bb2002a50b26 to your computer and use it in GitHub Desktop.
Save LespiletteMaxime/aaaea7c8319163914e89bb2002a50b26 to your computer and use it in GitHub Desktop.
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Str;
class MakeAll extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'make:all {name}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Create all assets';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$name = $this->argument('name');
$table = Str::plural(Str::snake(class_basename($name)));
//
$this->call('make:model', ['name' => $name]);
$this->call('make:migration', ['name' => "create_{$table}_table", '--create' => $table]);
$this->call('make:controller', ['name' => $name . 'Controller', '--resource']);
$this->call('make:seeder', ['name' => $name . 'Seeder']);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment