@@ -3,11 +3,11 @@ |
||
3 | 3 | |
4 | 4 | class RouteCommand extends BaseCommand { |
5 | 5 | |
6 | - protected $signature = 'wn:route |
|
6 | + protected $signature = 'wn:route |
|
7 | 7 | {resource : Name of the resource.} |
8 | 8 | {--controller= : Name of the RESTful controller.}'; |
9 | 9 | |
10 | - protected $description = 'Generates RESTful routes.'; |
|
10 | + protected $description = 'Generates RESTful routes.'; |
|
11 | 11 | |
12 | 12 | public function handle() |
13 | 13 | { |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | |
4 | 4 | class ModelCommand extends BaseCommand { |
5 | 5 | |
6 | - protected $signature = 'wn:model |
|
6 | + protected $signature = 'wn:model |
|
7 | 7 | {name : Name of the model.} |
8 | 8 | {--fillable= : the fillable fields.} |
9 | 9 | {--dates= : date fields.} |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | {--force= : override the existing files} |
19 | 19 | '; |
20 | 20 | |
21 | - protected $description = 'Generates a model class for a RESTfull resource'; |
|
21 | + protected $description = 'Generates a model class for a RESTfull resource'; |
|
22 | 22 | |
23 | 23 | public function handle() |
24 | 24 | { |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | |
43 | 43 | protected function getAsArrayFields($arg, $isOption = true) |
44 | 44 | { |
45 | - $arg = ($isOption) ? $this->option($arg) : $this->argument($arg); |
|
45 | + $arg = ($isOption) ? $this->option($arg) : $this->argument($arg); |
|
46 | 46 | if(is_string($arg)){ |
47 | - $arg = explode(',', $arg); |
|
47 | + $arg = explode(',', $arg); |
|
48 | 48 | } else if(! is_array($arg)) { |
49 | 49 | $arg = []; |
50 | 50 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | protected function getNamespace() |
57 | 57 | { |
58 | - return str_replace(' ', '\\', ucwords(str_replace('/', ' ', $this->option('path')))); |
|
58 | + return str_replace(' ', '\\', ucwords(str_replace('/', ' ', $this->option('path')))); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | protected function getRelations() |
@@ -3,10 +3,10 @@ |
||
3 | 3 | |
4 | 4 | class ControllerRestActionsCommand extends BaseCommand { |
5 | 5 | |
6 | - protected $signature = 'wn:controller:rest-actions |
|
6 | + protected $signature = 'wn:controller:rest-actions |
|
7 | 7 | {--force= : override the existing files}'; |
8 | 8 | |
9 | - protected $description = 'Generates REST actions trait to use into controllers'; |
|
9 | + protected $description = 'Generates REST actions trait to use into controllers'; |
|
10 | 10 | |
11 | 11 | public function handle() |
12 | 12 | { |
@@ -3,32 +3,32 @@ |
||
3 | 3 | |
4 | 4 | class ControllerCommand extends BaseCommand { |
5 | 5 | |
6 | - protected $signature = 'wn:controller |
|
6 | + protected $signature = 'wn:controller |
|
7 | 7 | {model : Name of the model (with namespace if not App)} |
8 | 8 | {--no-routes= : without routes} |
9 | 9 | {--force= : override the existing files} |
10 | 10 | '; |
11 | 11 | |
12 | - protected $description = 'Generates RESTful controller using the RESTActions trait'; |
|
12 | + protected $description = 'Generates RESTful controller using the RESTActions trait'; |
|
13 | 13 | |
14 | 14 | public function handle() |
15 | 15 | { |
16 | - $model = $this->argument('model'); |
|
17 | - $name = ''; |
|
18 | - if(strrpos($model, "\\") === false){ |
|
19 | - $name = $model; |
|
20 | - $model = "App\\" . $model; |
|
21 | - } else { |
|
22 | - $name = explode("\\", $model); |
|
23 | - $name = $name[count($name) - 1]; |
|
24 | - } |
|
16 | + $model = $this->argument('model'); |
|
17 | + $name = ''; |
|
18 | + if(strrpos($model, "\\") === false){ |
|
19 | + $name = $model; |
|
20 | + $model = "App\\" . $model; |
|
21 | + } else { |
|
22 | + $name = explode("\\", $model); |
|
23 | + $name = $name[count($name) - 1]; |
|
24 | + } |
|
25 | 25 | $controller = ucwords(str_plural($name)) . 'Controller'; |
26 | 26 | $content = $this->getTemplate('controller') |
27 | - ->with([ |
|
28 | - 'name' => $controller, |
|
29 | - 'model' => $model |
|
30 | - ]) |
|
31 | - ->get(); |
|
27 | + ->with([ |
|
28 | + 'name' => $controller, |
|
29 | + 'model' => $model |
|
30 | + ]) |
|
31 | + ->get(); |
|
32 | 32 | |
33 | 33 | $this->save($content, "./app/Http/Controllers/{$controller}.php", "{$controller}"); |
34 | 34 |
@@ -10,10 +10,10 @@ |
||
10 | 10 | class BaseCommand extends Command { |
11 | 11 | |
12 | 12 | protected $fs; |
13 | - protected $templates; |
|
13 | + protected $templates; |
|
14 | 14 | |
15 | - public function __construct(Filesystem $fs) |
|
16 | - { |
|
15 | + public function __construct(Filesystem $fs) |
|
16 | + { |
|
17 | 17 | parent::__construct(); |
18 | 18 | |
19 | 19 | $this->fs = $fs; |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | |
4 | 4 | class FactoryCommand extends BaseCommand { |
5 | 5 | |
6 | - protected $signature = 'wn:factory |
|
6 | + protected $signature = 'wn:factory |
|
7 | 7 | {model : full qualified name of the model.} |
8 | 8 | {--fields= : the fields to generate.} |
9 | 9 | {--file= : the factories file.} |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | {--force= : override the existing files} |
12 | 12 | '; |
13 | 13 | |
14 | - protected $description = 'Generates a model factory'; |
|
14 | + protected $description = 'Generates a model factory'; |
|
15 | 15 | |
16 | 16 | public function handle() |
17 | 17 | { |
@@ -3,14 +3,14 @@ |
||
3 | 3 | |
4 | 4 | class PivotSeederCommand extends BaseCommand { |
5 | 5 | |
6 | - protected $signature = 'wn:pivot-seeder |
|
6 | + protected $signature = 'wn:pivot-seeder |
|
7 | 7 | {model1 : Name of the first model or table} |
8 | 8 | {model2 : Name of the second model or table} |
9 | 9 | {--count=10 : number of elements to add in database.} |
10 | 10 | {--force= : override the existing files} |
11 | 11 | '; |
12 | 12 | |
13 | - protected $description = 'Generates seeder for pivot table'; |
|
13 | + protected $description = 'Generates seeder for pivot table'; |
|
14 | 14 | |
15 | 15 | public function handle() |
16 | 16 | { |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | |
4 | 4 | class PivotTableCommand extends BaseCommand { |
5 | 5 | |
6 | - protected $signature = 'wn:pivot-table |
|
6 | + protected $signature = 'wn:pivot-table |
|
7 | 7 | {model1 : Name of the first model or table} |
8 | 8 | {model2 : Name of the second model or table} |
9 | 9 | {--add= : specifies additional columns like timestamps, softDeletes, rememberToken and nullableTimestamps.} |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | {--force= : override the existing files} |
12 | 12 | '; |
13 | 13 | |
14 | - protected $description = 'Generates creation migration for a pivot table'; |
|
14 | + protected $description = 'Generates creation migration for a pivot table'; |
|
15 | 15 | |
16 | 16 | protected $tables; |
17 | 17 |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | |
4 | 4 | class MigrationCommand extends BaseCommand { |
5 | 5 | |
6 | - protected $signature = 'wn:migration |
|
6 | + protected $signature = 'wn:migration |
|
7 | 7 | {table : The table name.} |
8 | 8 | {--schema= : the schema.} |
9 | 9 | {--add= : specifies additional columns like timestamps, softDeletes, rememberToken and nullableTimestamps.} |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | // {action : One of create, add, remove or drop options.} |
16 | 16 | // The action is only create for the moment |
17 | 17 | |
18 | - protected $description = 'Generates a migration to create a table with schema'; |
|
18 | + protected $description = 'Generates a migration to create a table with schema'; |
|
19 | 19 | |
20 | 20 | public function handle() |
21 | 21 | { |