@@ -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 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | $this->line("Cleaning code directory ..."); |
50 | 50 | |
51 | 51 | foreach ([base_path('laragen/app'), base_path('laragen/database')] as $dir) { |
52 | - if(file_exists($dir)){ |
|
52 | + if (file_exists($dir)) { |
|
53 | 53 | $fileSystem->removeDir($dir); |
54 | 54 | } |
55 | 55 | } |
@@ -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() |
@@ -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() |
@@ -5,17 +5,17 @@ discard block |
||
5 | 5 | use Prateekkarki\Laragen\Models\TypeResolver; |
6 | 6 | |
7 | 7 | /** |
8 | - * The LaragenType abstract class. This class cannot be instantiated. It's implementations are used to create new types. |
|
9 | - * Column instances are created from types that are implementations of this class. |
|
10 | - * |
|
11 | - * @method integer getSize() |
|
12 | - * @method integer getDataType() |
|
13 | - * @method array getPivotColumns() |
|
14 | - * @method void setSize() |
|
15 | - * @method void setIsRequired() |
|
16 | - * @method void setIsUnique() |
|
17 | - * @method void setIsDisplay() |
|
18 | - */ |
|
8 | + * The LaragenType abstract class. This class cannot be instantiated. It's implementations are used to create new types. |
|
9 | + * Column instances are created from types that are implementations of this class. |
|
10 | + * |
|
11 | + * @method integer getSize() |
|
12 | + * @method integer getDataType() |
|
13 | + * @method array getPivotColumns() |
|
14 | + * @method void setSize() |
|
15 | + * @method void setIsRequired() |
|
16 | + * @method void setIsUnique() |
|
17 | + * @method void setIsDisplay() |
|
18 | + */ |
|
19 | 19 | abstract class LaragenType |
20 | 20 | { |
21 | 21 | /** |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | |
213 | 213 | public function getTextRows() { |
214 | 214 | if (!$this->size) { |
215 | - return 4; |
|
215 | + return 4; |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | return floor($this->getsize() / 120); |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | protected function updateSeeder() { |
160 | 160 | $laragenSeederFile = $this->getPath("database/seeds/")."LaragenSeeder.php"; |
161 | 161 | |
162 | - if(self::$initializeFlag++ == 0) |
|
162 | + if (self::$initializeFlag++ == 0) |
|
163 | 163 | $this->initializeFile($laragenSeederFile, 'common/Seeder'); |
164 | 164 | |
165 | 165 | $this->insertIntoFile( |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $this->insertIntoFile( |
214 | 214 | $laragenSeederFile, |
215 | 215 | "\n // End factories", |
216 | - "\n".$this->getTabs(2)."factory(".$type->getPivot()."::class, " . ((int) config('laragen.options.seed_rows') * 2) . ")->create();", |
|
216 | + "\n".$this->getTabs(2)."factory(".$type->getPivot()."::class, ".((int) config('laragen.options.seed_rows') * 2).")->create();", |
|
217 | 217 | false |
218 | 218 | ); |
219 | 219 | } |
@@ -146,7 +146,9 @@ discard block |
||
146 | 146 | $foreignData = ""; |
147 | 147 | |
148 | 148 | foreach ($types as $type) { |
149 | - if ($type->hasSelfParent()) continue; |
|
149 | + if ($type->hasSelfParent()) { |
|
150 | + continue; |
|
151 | + } |
|
150 | 152 | $foreignData .= $this->buildTemplate('common/Factories/fragments/options', [ |
151 | 153 | '{{parent}}' => $type->getColumnKey(), |
152 | 154 | '{{parentModel}}' => $type->getRelatedModel() |
@@ -159,8 +161,9 @@ discard block |
||
159 | 161 | protected function updateSeeder() { |
160 | 162 | $laragenSeederFile = $this->getPath("database/seeds/")."LaragenSeeder.php"; |
161 | 163 | |
162 | - if(self::$initializeFlag++ == 0) |
|
163 | - $this->initializeFile($laragenSeederFile, 'common/Seeder'); |
|
164 | + if(self::$initializeFlag++ == 0) { |
|
165 | + $this->initializeFile($laragenSeederFile, 'common/Seeder'); |
|
166 | + } |
|
164 | 167 | |
165 | 168 | $this->insertIntoFile( |
166 | 169 | $laragenSeederFile, |
@@ -36,7 +36,7 @@ |
||
36 | 36 | ]; |
37 | 37 | |
38 | 38 | foreach ($migrationDirs as $dir) { |
39 | - if(is_dir(base_path($dir)) && count(glob( base_path($dir) . '*', GLOB_MARK ))){ |
|
39 | + if (is_dir(base_path($dir)) && count(glob(base_path($dir).'*', GLOB_MARK))) { |
|
40 | 40 | Artisan::call('migrate', [ |
41 | 41 | '--path' => $dir |
42 | 42 | ]); |
@@ -45,11 +45,11 @@ |
||
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 | } |
51 | - else{ |
|
52 | - throw new \Exception("Module '". $name. "' not found"); |
|
51 | + else { |
|
52 | + throw new \Exception("Module '".$name."' not found"); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 |
@@ -47,8 +47,7 @@ |
||
47 | 47 | public function getModule($name) { |
48 | 48 | if(isset($this->modules[$name])){ |
49 | 49 | return $this->modules[$name]; |
50 | - } |
|
51 | - else{ |
|
50 | + } else{ |
|
52 | 51 | throw new \Exception("Module '". $name. "' not found"); |
53 | 52 | } |
54 | 53 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | 'xs' => '200x200', |
26 | 26 | ], |
27 | 27 | 'events' => [ |
28 | - 'created','updated','deleted' |
|
28 | + 'created', 'updated', 'deleted' |
|
29 | 29 | ], |
30 | 30 | 'seed_rows' => 25, |
31 | 31 | 'listing_per_page' => 20, |