Skip to content

Commit 83672f5

Browse files
committed
Allow --force on middleware
1 parent 638afd8 commit 83672f5

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

src/Console/CreateMiddleware.php

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
namespace Inertia\Console;
44

55
use Illuminate\Console\GeneratorCommand;
6+
use Symfony\Component\Console\Input\InputOption;
67

78
class CreateMiddleware extends GeneratorCommand
89
{
910
/**
10-
* The name and signature of the console command.
11+
* The console command name.
1112
*
1213
* @var string
1314
*/
14-
protected $signature = 'inertia:middleware {name=HandleInertiaRequests : Name of the Middleware that should be created}';
15+
protected $name = 'inertia:middleware';
1516

1617
/**
1718
* The console command description.
@@ -47,4 +48,28 @@ protected function getDefaultNamespace($rootNamespace)
4748
{
4849
return $rootNamespace.'\Http\Middleware';
4950
}
51+
52+
/**
53+
* Get the console command arguments.
54+
*
55+
* @return array
56+
*/
57+
protected function getArguments()
58+
{
59+
return [
60+
['name', InputOption::VALUE_REQUIRED, 'Name of the Middleware that should be created', 'HandleInertiaRequests'],
61+
];
62+
}
63+
64+
/**
65+
* Get the console command options.
66+
*
67+
* @return array
68+
*/
69+
protected function getOptions()
70+
{
71+
return [
72+
['force', null, InputOption::VALUE_NONE, 'Create the class even if the Middleware already exists'],
73+
];
74+
}
5075
}

0 commit comments

Comments
 (0)