|
|
@@ -54,6 +54,18 @@ class TestMakeCommand extends \Illuminate\Foundation\Console\TestMakeCommand
|
|
|
$input= trim($this->argument('name'));
|
|
|
return str_replace('Service','',(explode(':',$input)[0]));
|
|
|
}
|
|
|
+ protected function getModelNamePlural()
|
|
|
+ {
|
|
|
+ $modelName=preg_replace('/s$/','$ses',$this->getModelName());
|
|
|
+ $modelName=preg_replace('/ch$/','$ches',$modelName);
|
|
|
+ $modelName=preg_replace('/sh$/','$shes',$modelName);
|
|
|
+ $modelName=preg_replace('/y$/','ies',$modelName);
|
|
|
+ $modelName=preg_replace('/[cC]hild$/','children',$modelName);
|
|
|
+ if(preg_match('/[cC]hildren$/',$modelName)==0){
|
|
|
+ $modelName=preg_replace('/([^s])$/','$1s',$modelName);
|
|
|
+ }
|
|
|
+ return $modelName;
|
|
|
+ }
|
|
|
protected function getMethodName()
|
|
|
{
|
|
|
$input= trim($this->argument('name'));
|
|
|
@@ -82,6 +94,7 @@ class TestMakeCommand extends \Illuminate\Foundation\Console\TestMakeCommand
|
|
|
$stub = str_replace(['{{ serviceName }}', '{{serviceName}}'], $this->getServiceName(), $stub);
|
|
|
$stub = str_replace(['{{ modelName }}', '{{modelName}}'], $this->getModelName(), $stub);
|
|
|
$stub = str_replace(['{{ modelNameUc }}', '{{modelNameUc}}'], ucfirst($this->getModelName()), $stub);
|
|
|
+ $stub = str_replace(['{{ modelNamePlural }}', '{{modelNamePlural}}'], ucfirst($this->getModelNamePlural()), $stub);
|
|
|
|
|
|
return str_replace(['DummyClass', '{{ class }}', '{{class}}'], $class, $stub);
|
|
|
}
|