Skip to content
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'],
];
}
}