We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | // we get the first column from database |
| 63 | 63 | // that is NOT indexed (usually primary, foreign keys) |
| 64 | 64 | foreach ($columns as $columnName => $columnProperties) { |
| 65 | - if (! in_array($columnName, $indexedColumns)) { |
|
| 65 | + if (!in_array($columnName, $indexedColumns)) { |
|
| 66 | 66 | |
| 67 | 67 | //check for convention "field<_id>" in case developer didn't add foreign key constraints. |
| 68 | 68 | if (strpos($columnName, '_id') !== false) { |
@@ -93,9 +93,9 @@ |
||
| 93 | 93 | // if there's a column in the db for this field name |
| 94 | 94 | // most likely it doesn't need 'entity', UNLESS it's a foreign key |
| 95 | 95 | // TODO: make this work |
| 96 | - if ($relation_method = $this->checkIfFieldNameBelongsToAnyRelation($field['name'])) { |
|
| 97 | - $field['entity'] = $relation_method['entity']; |
|
| 98 | - } |
|
| 96 | + if ($relation_method = $this->checkIfFieldNameBelongsToAnyRelation($field['name'])) { |
|
| 97 | + $field['entity'] = $relation_method['entity']; |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | 100 | return $field; |
| 101 | 101 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | return ['name' => $field]; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - if (is_array($field) && ! isset($field['name'])) { |
|
| 44 | + if (is_array($field) && !isset($field['name'])) { |
|
| 45 | 45 | abort(500, 'All fields must have their name defined'); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | // if there's a method on the model with this name |
| 71 | 71 | if (method_exists($this->model, $field['name'])) { |
| 72 | 72 | |
| 73 | - if($this->model->checkIfMethodReturnRelation($field['name'])) { |
|
| 73 | + if ($this->model->checkIfMethodReturnRelation($field['name'])) { |
|
| 74 | 74 | $field['entity'] = $field['name']; |
| 75 | 75 | } |
| 76 | 76 | return $field; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $possibleMethodName = Str::replaceLast('_id', '', $field['name']); |
| 84 | 84 | |
| 85 | 85 | if (method_exists($this->model, $possibleMethodName)) { |
| 86 | - if($this->model->checkIfMethodReturnRelation($field['name'])) { |
|
| 86 | + if ($this->model->checkIfMethodReturnRelation($field['name'])) { |
|
| 87 | 87 | $field['entity'] = $possibleMethodName; |
| 88 | 88 | } |
| 89 | 89 | return $field; |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | protected function makeSureFieldHasRelationshipData($field) |
| 104 | 104 | { |
| 105 | 105 | // only do this if "entity" is defined on the field |
| 106 | - if (! isset($field['entity'])) { |
|
| 106 | + if (!isset($field['entity'])) { |
|
| 107 | 107 | return $field; |
| 108 | 108 | } |
| 109 | 109 | |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | { |
| 123 | 123 | // if this is a relation type field and no corresponding model was specified, |
| 124 | 124 | // get it from the relation method defined in the main model |
| 125 | - if (isset($field['entity']) && ! isset($field['model'])) { |
|
| 125 | + if (isset($field['entity']) && !isset($field['model'])) { |
|
| 126 | 126 | $field['model'] = $this->getRelationModel($field['entity']); |
| 127 | 127 | } |
| 128 | 128 | |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | { |
| 134 | 134 | // if there's a model defined, but no attribute |
| 135 | 135 | // guess an attribute using the indentifiableAttribute functionality in CrudTrait |
| 136 | - if (isset($field['model']) && ! isset($field['attribute'])) { |
|
| 137 | - $field['attribute'] = call_user_func([(new $field['model']),'identifiableAttribute']); |
|
| 136 | + if (isset($field['model']) && !isset($field['attribute'])) { |
|
| 137 | + $field['attribute'] = call_user_func([(new $field['model']), 'identifiableAttribute']); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | return $field; |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | protected function makeSureFieldHasLabel($field) |
| 151 | 151 | { |
| 152 | - if (! isset($field['label'])) { |
|
| 152 | + if (!isset($field['label'])) { |
|
| 153 | 153 | $name = is_array($field['name']) ? $field['name'][0] : $field['name']; |
| 154 | 154 | $name = str_replace('_id', '', $name); |
| 155 | 155 | $field['label'] = mb_ucfirst(str_replace('_', ' ', $name)); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | */ |
| 168 | 168 | protected function makeSureFieldHasType($field) |
| 169 | 169 | { |
| 170 | - if (! isset($field['type'])) { |
|
| 170 | + if (!isset($field['type'])) { |
|
| 171 | 171 | $field['type'] = $this->inferFieldTypeFromDbColumnType($field['name']); |
| 172 | 172 | } |
| 173 | 173 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | { |
| 185 | 185 | // if a tab was mentioned, we should enable it |
| 186 | 186 | if (isset($field['tab'])) { |
| 187 | - if (! $this->tabsEnabled()) { |
|
| 187 | + if (!$this->tabsEnabled()) { |
|
| 188 | 188 | $this->enableTabs(); |
| 189 | 189 | } |
| 190 | 190 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | if (in_array($fieldName, array_column($relations, 'name'))) { |
| 27 | - return array_filter($relations, function ($arr) use ($fieldName) { |
|
| 27 | + return array_filter($relations, function($arr) use ($fieldName) { |
|
| 28 | 28 | if (isset($arr['name'])) { |
| 29 | 29 | return $arr['name'] == $fieldName; |
| 30 | 30 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | return false; |
| 54 | 54 | |
| 55 | - }catch(\Exception $e) { |
|
| 55 | + } catch (\Exception $e) { |
|
| 56 | 56 | return false; |
| 57 | 57 | } |
| 58 | 58 | } |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | } |
| 53 | 53 | return false; |
| 54 | 54 | |
| 55 | - }catch(\Exception $e) { |
|
| 55 | + } catch(\Exception $e) { |
|
| 56 | 56 | return false; |
| 57 | 57 | } |
| 58 | 58 | } |
@@ -45,8 +45,8 @@ discard block |
||
| 45 | 45 | // otherwise assume the arguments are actually the configuration array |
| 46 | 46 | $config = []; |
| 47 | 47 | |
| 48 | - if (! is_array($arg)) { |
|
| 49 | - if (! class_exists($arg)) { |
|
| 48 | + if (!is_array($arg)) { |
|
| 49 | + if (!class_exists($arg)) { |
|
| 50 | 50 | return response()->json(['error' => 'Class: '.$arg.' does not exists'], 500); |
| 51 | 51 | } |
| 52 | 52 | $config['model'] = $arg; |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $config['searchable_attributes'] = $config['searchable_attributes'] ?? $model_instance->identifiableAttribute(); |
| 61 | 61 | $config['query'] = isset($config['query']) && is_callable($config['query']) ? $config['query']($config['model']) : $model_instance; // if a closure that has been passed as "query", use the closure - otherwise use the model |
| 62 | 62 | |
| 63 | - if(!is_array($config['searchable_attributes'])) { |
|
| 63 | + if (!is_array($config['searchable_attributes'])) { |
|
| 64 | 64 | $config['searchable_attributes'] = [$config['searchable_attributes']]; |
| 65 | 65 | } |
| 66 | 66 | // FetchOperation sends an empty query to retrieve the default entry for select when field is not nullable. |
@@ -69,8 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | if ($search_string === false) { |
| 71 | 71 | return ($config['paginate'] !== false) ? |
| 72 | - $config['query']->paginate($config['paginate']) : |
|
| 73 | - $config['query']->get(); |
|
| 72 | + $config['query']->paginate($config['paginate']) : $config['query']->get(); |
|
| 74 | 73 | } |
| 75 | 74 | |
| 76 | 75 | $textColumnTypes = ['string', 'json_string', 'text']; |
@@ -88,7 +87,6 @@ discard block |
||
| 88 | 87 | |
| 89 | 88 | // return the results with or without pagination |
| 90 | 89 | return ($config['paginate'] !== false) ? |
| 91 | - $config['query']->paginate($config['paginate']) : |
|
| 92 | - $config['query']->get(); |
|
| 90 | + $config['query']->paginate($config['paginate']) : $config['query']->get(); |
|
| 93 | 91 | } |
| 94 | 92 | } |