@@ -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() |
@@ -5,9 +5,9 @@ discard block |
||
| 5 | 5 | use Prateekkarki\Laragen\Models\TypeResolver; |
| 6 | 6 | |
| 7 | 7 | /** |
| 8 | - * @method integer getSize() |
|
| 9 | - * @method array getPivotColumns() |
|
| 10 | - */ |
|
| 8 | + * @method integer getSize() |
|
| 9 | + * @method array getPivotColumns() |
|
| 10 | + */ |
|
| 11 | 11 | abstract class LaragenType |
| 12 | 12 | { |
| 13 | 13 | protected $unique; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | public function getTextRows() { |
| 141 | 141 | if (!$this->size) { |
| 142 | - return 4; |
|
| 142 | + return 4; |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | 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 | ]); |