@@ -64,10 +64,11 @@ |
||
64 | 64 | $itemGenerator = new $generator($module); |
65 | 65 | $returnedFiles = $itemGenerator->generate(); |
66 | 66 | |
67 | - if (!is_array($returnedFiles)) |
|
68 | - $generatedFiles[] = $returnedFiles; |
|
69 | - else |
|
70 | - $generatedFiles = array_merge($generatedFiles, $returnedFiles); |
|
67 | + if (!is_array($returnedFiles)) { |
|
68 | + $generatedFiles[] = $returnedFiles; |
|
69 | + } else { |
|
70 | + $generatedFiles = array_merge($generatedFiles, $returnedFiles); |
|
71 | + } |
|
71 | 72 | |
72 | 73 | $bar->advance(); |
73 | 74 | } |
@@ -51,14 +51,14 @@ |
||
51 | 51 | $this->insertIntoFile( |
52 | 52 | $mainMenuFile, |
53 | 53 | '{{-- Main Menu --}}', |
54 | - "\n".'<li class="nav-item dropdown"> |
|
54 | + "\n".'<li class="nav-item dropdown"> |
|
55 | 55 | <a href="#" class="nav-link has-dropdown" data-toggle="dropdown"><i class="fas fa-columns"></i> <span> '.Str::plural($this->module->getModelName()).' </span></a> |
56 | 56 | <ul class="dropdown-menu"> |
57 | 57 | <li><a class="nav-link" href="{{ route("backend.'.$this->module->getModuleName().'.create") }}"> Add new '.Str::plural($this->module->getModelName()).'</a></li> |
58 | 58 | <li><a class="nav-link" href="{{ route("backend.'.$this->module->getModuleName().'.index") }}">All '.Str::plural($this->module->getModelName()).'</a></li> |
59 | 59 | </ul> |
60 | 60 | </li>' |
61 | - ); |
|
61 | + ); |
|
62 | 62 | return $this->generatedFiles; |
63 | 63 | } |
64 | 64 |
@@ -9,7 +9,7 @@ |
||
9 | 9 | class Notification extends BaseGenerator implements GeneratorInterface |
10 | 10 | { |
11 | 11 | private static $destination = "laragen/app/Notifications"; |
12 | - private static $namespace = "Laragen\App\Notifications"; |
|
12 | + private static $namespace = "Laragen\App\Notifications"; |
|
13 | 13 | private static $template = "backend/notifications/notification"; |
14 | 14 | |
15 | 15 | public function generate() |
@@ -7,12 +7,12 @@ discard block |
||
7 | 7 | class Request extends BaseGenerator implements GeneratorInterface |
8 | 8 | { |
9 | 9 | private static $destination = "laragen/app/Http/Requests/Backend"; |
10 | - private static $namespace = "Laragen\App\Http\Requests\Backend"; |
|
11 | - private static $template = "backend/Request"; |
|
10 | + private static $namespace = "Laragen\App\Http\Requests\Backend"; |
|
11 | + private static $template = "backend/Request"; |
|
12 | 12 | |
13 | 13 | private static $childDestination = "app/Http/Requests/Backend"; |
14 | - private static $childNamespace = "App\Http\Requests\Backend"; |
|
15 | - private static $childTemplate = "backend/EmptyClass"; |
|
14 | + private static $childNamespace = "App\Http\Requests\Backend"; |
|
15 | + private static $childTemplate = "backend/EmptyClass"; |
|
16 | 16 | |
17 | 17 | public function generate() |
18 | 18 | { |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $childTemplate = $this->buildTemplate(self::$childTemplate, [ |
30 | 30 | '{{namespace}}' => self::$childNamespace, |
31 | 31 | '{{className}}' => $this->module->getModelName()."Request", |
32 | - '{{extendsClass}}' => self::$namespace . '\\' . $this->module->getModelName()."Request" |
|
32 | + '{{extendsClass}}' => self::$namespace.'\\'.$this->module->getModelName()."Request" |
|
33 | 33 | ]); |
34 | 34 | |
35 | 35 | $fullFilePath = $this->getPath(self::$destination."/").$this->module->getModelName()."Request".".php"; |
@@ -7,12 +7,12 @@ discard block |
||
7 | 7 | class Controller extends BaseGenerator implements GeneratorInterface |
8 | 8 | { |
9 | 9 | private static $destination = "laragen/app/Http/Controllers/Backend"; |
10 | - private static $namespace = "Laragen\App\Http\Controllers\Backend"; |
|
11 | - private static $template = "backend/Controller"; |
|
10 | + private static $namespace = "Laragen\App\Http\Controllers\Backend"; |
|
11 | + private static $template = "backend/Controller"; |
|
12 | 12 | |
13 | 13 | private static $childDestination = "app/Http/Controllers/Backend"; |
14 | - private static $childNamespace = "App\Http\Controllers\Backend"; |
|
15 | - private static $childTemplate = "backend/EmptyClass"; |
|
14 | + private static $childNamespace = "App\Http\Controllers\Backend"; |
|
15 | + private static $childTemplate = "backend/EmptyClass"; |
|
16 | 16 | |
17 | 17 | public function generate() |
18 | 18 | { |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $childTemplate = $this->buildTemplate(self::$childTemplate, [ |
34 | 34 | '{{namespace}}' => self::$childNamespace, |
35 | 35 | '{{className}}' => $this->module->getModelName()."Controller", |
36 | - '{{extendsClass}}' => self::$namespace . '\\' . $this->module->getModelName()."Controller" |
|
36 | + '{{extendsClass}}' => self::$namespace.'\\'.$this->module->getModelName()."Controller" |
|
37 | 37 | ]); |
38 | 38 | |
39 | 39 |
@@ -8,12 +8,12 @@ |
||
8 | 8 | class Model extends BaseGenerator implements GeneratorInterface |
9 | 9 | { |
10 | 10 | protected $destination = "laragen/app/Models"; |
11 | - protected $namespace = "Laragen\App\Models"; |
|
11 | + protected $namespace = "Laragen\App\Models"; |
|
12 | 12 | protected $template = "common/Models/Model"; |
13 | 13 | protected $pivotTemplate = "common/Models/Pivot"; |
14 | 14 | |
15 | 15 | protected $childDestination = "app/Models"; |
16 | - protected $childNamespace = "App\Models"; |
|
16 | + protected $childNamespace = "App\Models"; |
|
17 | 17 | |
18 | 18 | public function generate() |
19 | 19 | { |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | { |
78 | 78 | $filteredTypes = []; |
79 | 79 | $options = is_array($options) ? $options : [$options]; |
80 | - foreach($this->getPivotColumns() as $type){ |
|
80 | + foreach ($this->getPivotColumns() as $type) { |
|
81 | 81 | foreach ($options as $option) { |
82 | - if($type->$option()){ |
|
82 | + if ($type->$option()) { |
|
83 | 83 | $filteredTypes[] = $columnsOnly ? $type->getColumn() : $type; |
84 | 84 | break; |
85 | 85 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | public function getForeignKey() |
118 | 118 | { |
119 | - return $this->columnName . "_id"; |
|
119 | + return $this->columnName."_id"; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | public function getRelatedModel() |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | public function getChildModel() |
138 | 138 | { |
139 | - return ucfirst(Str::camel(Str::singular($this->typeOption ?? $this->columnName ))); |
|
139 | + return ucfirst(Str::camel(Str::singular($this->typeOption ?? $this->columnName))); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | public function getParentModel() |
@@ -4,10 +4,10 @@ |
||
4 | 4 | use Illuminate\Support\Str; |
5 | 5 | use Prateekkarki\Laragen\Models\TypeResolver; |
6 | 6 | |
7 | - /** |
|
8 | - * @method integer getSize() |
|
9 | - * @method array getPivotColumns() |
|
10 | - */ |
|
7 | + /** |
|
8 | + * @method integer getSize() |
|
9 | + * @method array getPivotColumns() |
|
10 | + */ |
|
11 | 11 | abstract class LaragenType |
12 | 12 | { |
13 | 13 | protected $uniqueFlag; |
@@ -45,10 +45,10 @@ |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | public function getModule($name) { |
48 | - if(isset($this->modules[$name])) |
|
48 | + if (isset($this->modules[$name])) |
|
49 | 49 | return $this->modules[$name]; |
50 | 50 | else |
51 | - throw new \Exception("Module '". $name. "' not found"); |
|
51 | + throw new \Exception("Module '".$name."' not found"); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | protected function getModulesRecursive($moduleName, $moduleData) { |
@@ -45,10 +45,11 @@ |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | public function getModule($name) { |
48 | - if(isset($this->modules[$name])) |
|
49 | - return $this->modules[$name]; |
|
50 | - else |
|
51 | - throw new \Exception("Module '". $name. "' not found"); |
|
48 | + if(isset($this->modules[$name])) { |
|
49 | + return $this->modules[$name]; |
|
50 | + } else { |
|
51 | + throw new \Exception("Module '". $name. "' not found"); |
|
52 | + } |
|
52 | 53 | } |
53 | 54 | |
54 | 55 | protected function getModulesRecursive($moduleName, $moduleData) { |
@@ -44,8 +44,9 @@ |
||
44 | 44 | $data = new TypeResolver($this->name, $column, $typeOptions); |
45 | 45 | $type = $data->getLaragenType(); |
46 | 46 | $this->columnsData[$column] = $type; |
47 | - if ($type->isDisplay()) |
|
48 | - $this->displayColumns[] = $type; |
|
47 | + if ($type->isDisplay()) { |
|
48 | + $this->displayColumns[] = $type; |
|
49 | + } |
|
49 | 50 | } |
50 | 51 | |
51 | 52 | if (sizeof($this->displayColumns) == 0) { |