Skip to content

Instantly share code, notes, and snippets.

@browner12
Created October 31, 2016 23:44
Show Gist options
  • Select an option

  • Save browner12/1345c38b7db9ea7193c0118080b6a8d7 to your computer and use it in GitHub Desktop.

Select an option

Save browner12/1345c38b7db9ea7193c0118080b6a8d7 to your computer and use it in GitHub Desktop.

Revisions

  1. browner12 created this gist Oct 31, 2016.
    38 changes: 38 additions & 0 deletions MakeAllCommand.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,38 @@
    <?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']);
    }
    }