diff --git a/src/Commands/CrudApiCommand.php b/src/Commands/CrudApiCommand.php index 7690270..8c8416c 100644 --- a/src/Commands/CrudApiCommand.php +++ b/src/Commands/CrudApiCommand.php @@ -4,6 +4,7 @@ use File; use Illuminate\Console\Command; +use Illuminate\Support\Str; class CrudApiCommand extends Command { @@ -59,12 +60,12 @@ public function __construct() public function handle() { $name = $this->argument('name'); - $modelName = str_singular($name); - $migrationName = str_plural(snake_case($name)); + $modelName = Str::singular($name); + $migrationName = Str::plural(Str::snake($name)); $tableName = $migrationName; $routeGroup = $this->option('route-group'); - $this->routeName = ($routeGroup) ? $routeGroup . '/' . snake_case($name, '-') : snake_case($name, '-'); + $this->routeName = ($routeGroup) ? $routeGroup . '/' . Str::snake($name, '-') : Str::snake($name, '-'); $perPage = intval($this->option('pagination')); $controllerNamespace = ($this->option('controller-namespace')) ? $this->option('controller-namespace') . '\\' : ''; diff --git a/src/Commands/CrudApiControllerCommand.php b/src/Commands/CrudApiControllerCommand.php index 0a8e640..a17c6f3 100644 --- a/src/Commands/CrudApiControllerCommand.php +++ b/src/Commands/CrudApiControllerCommand.php @@ -3,6 +3,7 @@ namespace Appzcoder\CrudGenerator\Commands; use Illuminate\Console\GeneratorCommand; +use Illuminate\Support\Str; class CrudApiControllerCommand extends GeneratorCommand { @@ -85,7 +86,7 @@ protected function buildClass($name) $stub = $this->files->get($this->getStub()); $crudName = strtolower($this->option('crud-name')); - $crudNameSingular = str_singular($crudName); + $crudNameSingular = Str::singular($crudName); $modelName = $this->option('model-name'); $modelNamespace = $this->option('model-namespace'); $perPage = intval($this->option('pagination')); diff --git a/src/Commands/CrudCommand.php b/src/Commands/CrudCommand.php index dd255c6..84f041c 100644 --- a/src/Commands/CrudCommand.php +++ b/src/Commands/CrudCommand.php @@ -4,6 +4,7 @@ use File; use Illuminate\Console\Command; +use Illuminate\Support\Str; class CrudCommand extends Command { @@ -63,12 +64,12 @@ public function __construct() public function handle() { $name = $this->argument('name'); - $modelName = str_singular($name); - $migrationName = str_plural(snake_case($name)); + $modelName = Str::singular($name); + $migrationName = Str::plural(Str::snake($name)); $tableName = $migrationName; $routeGroup = $this->option('route-group'); - $this->routeName = ($routeGroup) ? $routeGroup . '/' . snake_case($name, '-') : snake_case($name, '-'); + $this->routeName = ($routeGroup) ? $routeGroup . '/' . Str::snake($name, '-') : Str::snake($name, '-'); $perPage = intval($this->option('pagination')); $controllerNamespace = ($this->option('controller-namespace')) ? $this->option('controller-namespace') . '\\' : ''; diff --git a/src/Commands/CrudControllerCommand.php b/src/Commands/CrudControllerCommand.php index a32c616..04853a1 100644 --- a/src/Commands/CrudControllerCommand.php +++ b/src/Commands/CrudControllerCommand.php @@ -3,6 +3,7 @@ namespace Appzcoder\CrudGenerator\Commands; use Illuminate\Console\GeneratorCommand; +use Illuminate\Support\Str; class CrudControllerCommand extends GeneratorCommand { @@ -89,14 +90,14 @@ protected function buildClass($name) $viewPath = $this->option('view-path') ? $this->option('view-path') . '.' : ''; $crudName = strtolower($this->option('crud-name')); - $crudNameSingular = str_singular($crudName); + $crudNameSingular = Str::singular($crudName); $modelName = $this->option('model-name'); $modelNamespace = $this->option('model-namespace'); $routeGroup = ($this->option('route-group')) ? $this->option('route-group') . '/' : ''; $routePrefix = ($this->option('route-group')) ? $this->option('route-group') : ''; $routePrefixCap = ucfirst($routePrefix); $perPage = intval($this->option('pagination')); - $viewName = snake_case($this->option('crud-name'), '-'); + $viewName = Str::snake($this->option('crud-name'), '-'); $fields = $this->option('fields'); $validations = rtrim($this->option('validations'), ';'); diff --git a/src/Commands/CrudViewCommand.php b/src/Commands/CrudViewCommand.php index 09392bb..173297b 100644 --- a/src/Commands/CrudViewCommand.php +++ b/src/Commands/CrudViewCommand.php @@ -4,6 +4,7 @@ use File; use Illuminate\Console\Command; +use Illuminate\Support\Str; class CrudViewCommand extends Command { @@ -13,15 +14,15 @@ class CrudViewCommand extends Command * @var string */ protected $signature = 'crud:view - {name : The name of the Crud.} - {--fields= : The field names for the form.} - {--view-path= : The name of the view path.} - {--route-group= : Prefix of the route group.} - {--pk=id : The name of the primary key.} - {--validations= : Validation rules for the fields.} - {--form-helper=html : Helper for the form.} - {--custom-data= : Some additional values to use in the crud.} - {--localize=no : Localize the view? yes|no.}'; + {name : The name of the Crud.} + {--fields= : The field names for the form.} + {--view-path= : The name of the view path.} + {--route-group= : Prefix of the route group.} + {--pk=id : The name of the primary key.} + {--validations= : Validation rules for the fields.} + {--form-helper=html : Helper for the form.} + {--custom-data= : Some additional values to use in the crud.} + {--localize=no : Localize the view? yes|no.}'; /** * The console command description. @@ -241,14 +242,14 @@ class CrudViewCommand extends Command /** * Create a new command instance. - * */ public function __construct() { parent::__construct(); if (config('crudgenerator.view_columns_number')) { - $this->defaultColumnsToShow = config('crudgenerator.view_columns_number'); + $this + ->defaultColumnsToShow = config('crudgenerator.view_columns_number'); } $this->delimiter = config('crudgenerator.custom_delimiter') @@ -272,8 +273,8 @@ public function handle() $this->crudName = strtolower($this->argument('name')); $this->varName = lcfirst($this->argument('name')); $this->crudNameCap = ucwords($this->crudName); - $this->crudNameSingular = str_singular($this->crudName); - $this->modelName = str_singular($this->argument('name')); + $this->crudNameSingular = Str::singular($this->crudName); + $this->modelName = Str::singular($this->argument('name')); $this->modelNameCap = ucfirst($this->modelName); $this->customData = $this->option('custom-data'); $this->primaryKey = $this->option('pk'); @@ -282,7 +283,7 @@ public function handle() : $this->option('route-group'); $this->routePrefix = ($this->option('route-group')) ? $this->option('route-group') : ''; $this->routePrefixCap = ucfirst($this->routePrefix); - $this->viewName = snake_case($this->argument('name'), '-'); + $this->viewName = Str::snake($this->argument('name'), '-'); $viewDirectory = config('view.paths')[0] . '/'; if ($this->option('view-path')) { @@ -314,7 +315,7 @@ public function handle() $this->formFields[$x]['name'] = trim($itemArray[0]); $this->formFields[$x]['type'] = trim($itemArray[1]); - $this->formFields[$x]['required'] = preg_match('/' . $itemArray[0] . '/', $validations) ? true : false; + $this->formFields[$x]['required'] = preg_match('/' . $itemArray[0] . '/', $validations)? true : false; if (($this->formFields[$x]['type'] === 'select' || $this->formFields[$x]['type'] === 'enum')