Skip to content

Commit

Permalink
Merge pull request #166 from inertiajs/middleware-allow-force
Browse files Browse the repository at this point in the history
Middleware: Allow --force option
  • Loading branch information
reinink authored Oct 14, 2020
2 parents 638afd8 + 83672f5 commit b30e7a8
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions src/Console/CreateMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
namespace Inertia\Console;

use Illuminate\Console\GeneratorCommand;
use Symfony\Component\Console\Input\InputOption;

class CreateMiddleware extends GeneratorCommand
{
/**
* The name and signature of the console command.
* The console command name.
*
* @var string
*/
protected $signature = 'inertia:middleware {name=HandleInertiaRequests : Name of the Middleware that should be created}';
protected $name = 'inertia:middleware';

/**
* The console command description.
Expand Down Expand Up @@ -47,4 +48,28 @@ protected function getDefaultNamespace($rootNamespace)
{
return $rootNamespace.'\Http\Middleware';
}

/**
* Get the console command arguments.
*
* @return array
*/
protected function getArguments()
{
return [
['name', InputOption::VALUE_REQUIRED, 'Name of the Middleware that should be created', 'HandleInertiaRequests'],
];
}

/**
* Get the console command options.
*
* @return array
*/
protected function getOptions()
{
return [
['force', null, InputOption::VALUE_NONE, 'Create the class even if the Middleware already exists'],
];
}
}

0 comments on commit b30e7a8

Please sign in to comment.