Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Middleware: Allow --force option #166

Merged
merged 1 commit into from
Oct 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'],
];
}
}