@@ -62,7 +62,9 @@ discard block |
||
| 62 | 62 | { |
| 63 | 63 | $file = preg_split( " (/|\\\\) ", (string)$this->argument('name')) ?? []; |
| 64 | 64 | |
| 65 | - if(!$file) return "Something wrong with the inputs !"; |
|
| 65 | + if(!$file) { |
|
| 66 | + return "Something wrong with the inputs !"; |
|
| 67 | + } |
|
| 66 | 68 | |
| 67 | 69 | $this->repoName = $file[count($file) - 1]; |
| 68 | 70 | |
@@ -107,8 +109,7 @@ discard block |
||
| 107 | 109 | { |
| 108 | 110 | $createHtml = $this->FormGenerator->generateForm($entity); |
| 109 | 111 | $editHtml = $this->FormGenerator->generateForm($entity,'put'); |
| 110 | - } |
|
| 111 | - else |
|
| 112 | + } else |
|
| 112 | 113 | { |
| 113 | 114 | if(!$this->confirm('There is no entity for '.$this->repoName.", do you want to continue (this will disable form generator) ?")) |
| 114 | 115 | { |
@@ -135,8 +136,9 @@ discard block |
||
| 135 | 136 | function getEntity($path) |
| 136 | 137 | { |
| 137 | 138 | $myClass = 'App\Entities\\'.$path."\\".$this->repoName; |
| 138 | - if(!class_exists($myClass)) |
|
| 139 | - return false; |
|
| 139 | + if(!class_exists($myClass)) { |
|
| 140 | + return false; |
|
| 141 | + } |
|
| 140 | 142 | |
| 141 | 143 | $refl = new ReflectionClass($myClass); |
| 142 | 144 | |
@@ -86,8 +86,9 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | function getFillables($entity) |
| 88 | 88 | { |
| 89 | - if(!empty($entity->getFillable())) |
|
| 90 | - return $entity->getFillable(); |
|
| 89 | + if(!empty($entity->getFillable())) { |
|
| 90 | + return $entity->getFillable(); |
|
| 91 | + } |
|
| 91 | 92 | |
| 92 | 93 | $columns = \Schema::getColumnListing($entity->getTable()); |
| 93 | 94 | |
@@ -107,8 +108,9 @@ discard block |
||
| 107 | 108 | */ |
| 108 | 109 | function getInputs($entity) |
| 109 | 110 | { |
| 110 | - if($this->inputs) |
|
| 111 | - return $this->inputs; |
|
| 111 | + if($this->inputs) { |
|
| 112 | + return $this->inputs; |
|
| 113 | + } |
|
| 112 | 114 | |
| 113 | 115 | return $this->generateInputs($entity); |
| 114 | 116 | } |
@@ -100,9 +100,9 @@ |
||
| 100 | 100 | } |
| 101 | 101 | }); |
| 102 | 102 | }); |
| 103 | + } else { |
|
| 104 | + $latest->orWhere($columns, 'like', "%" . $criteria['search'] . "%"); |
|
| 103 | 105 | } |
| 104 | - else |
|
| 105 | - $latest->orWhere($columns, 'like', "%" . $criteria['search'] . "%"); |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | unset($criteria['search']); |
@@ -319,9 +319,10 @@ |
||
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | if ($entity) { |
| 322 | - if($appendEntity) |
|
| 323 | - return response()->json( ['status' => true, 'message' => __('repository-generator.success'), 'data' => $entity], |
|
| 322 | + if($appendEntity) { |
|
| 323 | + return response()->json( ['status' => true, 'message' => __('repository-generator.success'), 'data' => $entity], |
|
| 324 | 324 | JsonResponse::HTTP_OK); |
| 325 | + } |
|
| 325 | 326 | return response()->json(null, JsonResponse::HTTP_NO_CONTENT); |
| 326 | 327 | } |
| 327 | 328 | |