We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | $this->setDoctrineTypesMapping(); |
| 23 | 23 | $this->getDbColumnTypes(); |
| 24 | 24 | |
| 25 | - array_map(function ($field) { |
|
| 25 | + array_map(function($field) { |
|
| 26 | 26 | $new_field = [ |
| 27 | 27 | 'name' => $field, |
| 28 | 28 | 'label' => $this->makeLabel($field), |
@@ -33,14 +33,14 @@ discard block |
||
| 33 | 33 | 'attributes' => [], |
| 34 | 34 | 'autoset' => true, |
| 35 | 35 | ]; |
| 36 | - if (! isset($this->create_fields[$field])) { |
|
| 36 | + if (!isset($this->create_fields[$field])) { |
|
| 37 | 37 | $this->create_fields[$field] = $new_field; |
| 38 | 38 | } |
| 39 | - if (! isset($this->update_fields[$field])) { |
|
| 39 | + if (!isset($this->update_fields[$field])) { |
|
| 40 | 40 | $this->update_fields[$field] = $new_field; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - if (! in_array($field, $this->model->getHidden()) && ! isset($this->columns[$field])) { |
|
| 43 | + if (!in_array($field, $this->model->getHidden()) && !isset($this->columns[$field])) { |
|
| 44 | 44 | $this->addColumn([ |
| 45 | 45 | 'name' => $field, |
| 46 | 46 | 'label' => $this->makeLabel($field), |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function getFieldTypeFromDbColumnType($field) |
| 82 | 82 | { |
| 83 | - if (! array_key_exists($field, $this->db_column_types)) { |
|
| 83 | + if (!array_key_exists($field, $this->db_column_types)) { |
|
| 84 | 84 | return 'text'; |
| 85 | 85 | } |
| 86 | 86 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | $types = ['enum' => 'string']; |
| 148 | 148 | $platform = \DB::getDoctrineConnection()->getDatabasePlatform(); |
| 149 | 149 | foreach ($types as $type_key => $type_value) { |
| 150 | - if (! $platform->hasDoctrineTypeMappingFor($type_key)) { |
|
| 150 | + if (!$platform->hasDoctrineTypeMappingFor($type_key)) { |
|
| 151 | 151 | $platform->registerDoctrineTypeMapping($type_key, $type_value); |
| 152 | 152 | } |
| 153 | 153 | } |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | $columns = $this->model->getConnection()->getSchemaBuilder()->getColumnListing($this->model->getTable()); |
| 203 | 203 | $fillable = $this->model->getFillable(); |
| 204 | 204 | |
| 205 | - if (! empty($fillable)) { |
|
| 205 | + if (!empty($fillable)) { |
|
| 206 | 206 | $columns = array_intersect($columns, $fillable); |
| 207 | 207 | } |
| 208 | 208 | |
@@ -2,8 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Backpack\CRUD\app\Console\Commands; |
| 4 | 4 | |
| 5 | -use Illuminate\Console\Command; |
|
| 6 | -use Symfony\Component\Process\Process; |
|
| 7 | 5 | use Backpack\Base\app\Console\Commands\Install as BaseInstall; |
| 8 | 6 | |
| 9 | 7 | class Install extends BaseInstall |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | $this->executeProcess('mkdir -p public/uploads'); |
| 54 | 54 | break; |
| 55 | 55 | case '\\': // windows |
| 56 | - if (! file_exists('public\uploads')) { |
|
| 56 | + if (!file_exists('public\uploads')) { |
|
| 57 | 57 | $this->executeProcess('mkdir public\uploads'); |
| 58 | 58 | } |
| 59 | 59 | break; |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | /** |
| 31 | 31 | * Execute the console command. |
| 32 | 32 | * |
| 33 | - * @return mixed |
|
| 33 | + * @return false|null |
|
| 34 | 34 | */ |
| 35 | 35 | public function handle() |
| 36 | 36 | { |
@@ -2,8 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Backpack\CRUD\PanelTraits; |
| 4 | 4 | |
| 5 | -use Illuminate\Database\Eloquent\Relations\HasOne; |
|
| 6 | 5 | use Illuminate\Database\Eloquent\Relations\BelongsTo; |
| 6 | +use Illuminate\Database\Eloquent\Relations\HasOne; |
|
| 7 | 7 | |
| 8 | 8 | trait Create |
| 9 | 9 | { |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | { |
| 91 | 91 | $all_relation_fields = $this->getRelationFields($form); |
| 92 | 92 | |
| 93 | - return array_where($all_relation_fields, function ($value, $key) { |
|
| 93 | + return array_where($all_relation_fields, function($value, $key) { |
|
| 94 | 94 | return isset($value['pivot']) && $value['pivot']; |
| 95 | 95 | }); |
| 96 | 96 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | private function createRelationsForItem($item, $formattedData) |
| 163 | 163 | { |
| 164 | - if (! isset($formattedData['relations'])) { |
|
| 164 | + if (!isset($formattedData['relations'])) { |
|
| 165 | 165 | return false; |
| 166 | 166 | } |
| 167 | 167 | |
@@ -219,11 +219,11 @@ discard block |
||
| 219 | 219 | $key = implode('.relations.', explode('.', $relationField['entity'])); |
| 220 | 220 | $fieldData = array_get($relationData, 'relations.'.$key, []); |
| 221 | 221 | |
| 222 | - if (! array_key_exists('model', $fieldData)) { |
|
| 222 | + if (!array_key_exists('model', $fieldData)) { |
|
| 223 | 223 | $fieldData['model'] = $relationField['model']; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - if (! array_key_exists('parent', $fieldData)) { |
|
| 226 | + if (!array_key_exists('parent', $fieldData)) { |
|
| 227 | 227 | $fieldData['parent'] = $this->getRelationModel($relationField['entity'], -1); |
| 228 | 228 | } |
| 229 | 229 | |
@@ -159,7 +159,7 @@ |
||
| 159 | 159 | * @param \Illuminate\Database\Eloquent\Model $item The current CRUD model. |
| 160 | 160 | * @param array $formattedData The form data. |
| 161 | 161 | * |
| 162 | - * @return bool|null |
|
| 162 | + * @return false|null |
|
| 163 | 163 | */ |
| 164 | 164 | private function createRelationsForItem($item, $formattedData) |
| 165 | 165 | { |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | foreach ($fields as &$field) { |
| 53 | 53 | // set the value |
| 54 | - if (! isset($field['value'])) { |
|
| 54 | + if (!isset($field['value'])) { |
|
| 55 | 55 | if (isset($field['subfields'])) { |
| 56 | 56 | $field['value'] = []; |
| 57 | 57 | foreach ($field['subfields'] as $subfield) { |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | // always have a hidden input for the entry id |
| 67 | - if (! array_key_exists('id', $fields)) { |
|
| 67 | + if (!array_key_exists('id', $fields)) { |
|
| 68 | 68 | $fields['id'] = [ |
| 69 | 69 | 'name' => $entry->getKeyName(), |
| 70 | 70 | 'value' => $entry->getKey(), |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | { |
| 88 | 88 | if (isset($field['entity'])) { |
| 89 | 89 | $relationArray = explode('.', $field['entity']); |
| 90 | - $relatedModel = array_reduce(array_splice($relationArray, 0, -1), function ($obj, $method) { |
|
| 90 | + $relatedModel = array_reduce(array_splice($relationArray, 0, -1), function($obj, $method) { |
|
| 91 | 91 | return $obj->{$method} ? $obj->{$method} : $obj; |
| 92 | 92 | }, $model); |
| 93 | 93 | |
@@ -7,14 +7,14 @@ |
||
| 7 | 7 | |
| 8 | 8 | <div class="form-group backpack-filter m-b-0"> |
| 9 | 9 | <?php |
| 10 | - $from = ''; |
|
| 11 | - $to = ''; |
|
| 12 | - if($filter->currentValue) { |
|
| 13 | - $range = (array)json_decode($filter->currentValue); |
|
| 14 | - $from = $range['from']; |
|
| 15 | - $to = $range['to']; |
|
| 16 | - } |
|
| 17 | - ?> |
|
| 10 | + $from = ''; |
|
| 11 | + $to = ''; |
|
| 12 | + if($filter->currentValue) { |
|
| 13 | + $range = (array)json_decode($filter->currentValue); |
|
| 14 | + $from = $range['from']; |
|
| 15 | + $to = $range['to']; |
|
| 16 | + } |
|
| 17 | + ?> |
|
| 18 | 18 | <div class="input-group"> |
| 19 | 19 | <input class="form-control pull-right from" |
| 20 | 20 | type="number" |
@@ -9,8 +9,8 @@ |
||
| 9 | 9 | <?php |
| 10 | 10 | $from = ''; |
| 11 | 11 | $to = ''; |
| 12 | - if($filter->currentValue) { |
|
| 13 | - $range = (array)json_decode($filter->currentValue); |
|
| 12 | + if ($filter->currentValue) { |
|
| 13 | + $range = (array) json_decode($filter->currentValue); |
|
| 14 | 14 | $from = $range['from']; |
| 15 | 15 | $to = $range['to']; |
| 16 | 16 | } |
@@ -167,18 +167,18 @@ |
||
| 167 | 167 | { |
| 168 | 168 | foreach ($modifications as $key => $newValue) { |
| 169 | 169 | switch (strtolower($form)) { |
| 170 | - case 'create': |
|
| 170 | + case 'create': |
|
| 171 | 171 | $this->create_fields[$field][$key] = $newValue; |
| 172 | - break; |
|
| 172 | + break; |
|
| 173 | 173 | |
| 174 | - case 'update': |
|
| 174 | + case 'update': |
|
| 175 | 175 | $this->update_fields[$field][$key] = $newValue; |
| 176 | - break; |
|
| 176 | + break; |
|
| 177 | 177 | |
| 178 | - default: |
|
| 178 | + default: |
|
| 179 | 179 | $this->create_fields[$field][$key] = $newValue; |
| 180 | - $this->update_fields[$field][$key] = $newValue; |
|
| 181 | - break; |
|
| 180 | + $this->update_fields[$field][$key] = $newValue; |
|
| 181 | + break; |
|
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | 184 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public function addField($field, $form = 'both') |
| 20 | 20 | { |
| 21 | - if (! empty($field['form'])) { |
|
| 21 | + if (!empty($field['form'])) { |
|
| 22 | 22 | $form = $field['form']; |
| 23 | 23 | } |
| 24 | 24 | // if the field_definition_array array is a string, it means the programmer was lazy and has only passed the name |
@@ -31,28 +31,28 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | // if this is a relation type field and no corresponding model was specified, get it from the relation method |
| 33 | 33 | // defined in the main model |
| 34 | - if (isset($completeFieldsArray['entity']) && ! isset($completeFieldsArray['model'])) { |
|
| 34 | + if (isset($completeFieldsArray['entity']) && !isset($completeFieldsArray['model'])) { |
|
| 35 | 35 | $completeFieldsArray['model'] = $this->getRelationModel($completeFieldsArray['entity']); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // if the label is missing, we should set it |
| 39 | - if (! isset($completeFieldsArray['label'])) { |
|
| 39 | + if (!isset($completeFieldsArray['label'])) { |
|
| 40 | 40 | $completeFieldsArray['label'] = mb_ucfirst(str_replace('_', ' ', $completeFieldsArray['name'])); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | // if the field type is missing, we should set it |
| 44 | - if (! isset($completeFieldsArray['type'])) { |
|
| 44 | + if (!isset($completeFieldsArray['type'])) { |
|
| 45 | 45 | $completeFieldsArray['type'] = $this->getFieldTypeFromDbColumnType($completeFieldsArray['name']); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | // if a tab was mentioned, we should enable it |
| 49 | 49 | if (isset($completeFieldsArray['tab'])) { |
| 50 | - if (! $this->tabsEnabled()) { |
|
| 50 | + if (!$this->tabsEnabled()) { |
|
| 51 | 51 | $this->enableTabs(); |
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - $this->transformFields($form, function ($fields) use ($completeFieldsArray) { |
|
| 55 | + $this->transformFields($form, function($fields) use ($completeFieldsArray) { |
|
| 56 | 56 | $fields[$completeFieldsArray['name']] = $completeFieldsArray; |
| 57 | 57 | |
| 58 | 58 | return $fields; |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function afterField($targetFieldName, $form = 'both') |
| 86 | 86 | { |
| 87 | - $this->transformFields($form, function ($fields) use ($targetFieldName) { |
|
| 87 | + $this->transformFields($form, function($fields) use ($targetFieldName) { |
|
| 88 | 88 | return $this->moveField($fields, $targetFieldName, false); |
| 89 | 89 | }); |
| 90 | 90 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | public function beforeField($targetFieldName, $form = 'both') |
| 99 | 99 | { |
| 100 | - $this->transformFields($form, function ($fields) use ($targetFieldName) { |
|
| 100 | + $this->transformFields($form, function($fields) use ($targetFieldName) { |
|
| 101 | 101 | return $this->moveField($fields, $targetFieldName, true); |
| 102 | 102 | }); |
| 103 | 103 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | public function removeField($name, $form = 'both') |
| 142 | 142 | { |
| 143 | - $this->transformFields($form, function ($fields) use ($name) { |
|
| 143 | + $this->transformFields($form, function($fields) use ($name) { |
|
| 144 | 144 | array_forget($fields, $name); |
| 145 | 145 | |
| 146 | 146 | return $fields; |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | public function removeFields($array_of_names, $form = 'both') |
| 157 | 157 | { |
| 158 | - if (! empty($array_of_names)) { |
|
| 158 | + if (!empty($array_of_names)) { |
|
| 159 | 159 | foreach ($array_of_names as $name) { |
| 160 | 160 | $this->removeField($name, $form); |
| 161 | 161 | } |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | public function removeAllFields($form = 'both') |
| 171 | 171 | { |
| 172 | 172 | $current_fields = $this->getCurrentFields(); |
| 173 | - if (! empty($current_fields)) { |
|
| 173 | + if (!empty($current_fields)) { |
|
| 174 | 174 | foreach ($current_fields as $field) { |
| 175 | 175 | $this->removeField($field['name'], $form); |
| 176 | 176 | } |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | $jsonCastables = ['array', 'object', 'json']; |
| 261 | 261 | $fieldCasting = $casted_attributes[$field['name']]; |
| 262 | 262 | |
| 263 | - if (in_array($fieldCasting, $jsonCastables) && isset($data[$field['name']]) && ! empty($data[$field['name']]) && ! is_array($data[$field['name']])) { |
|
| 263 | + if (in_array($fieldCasting, $jsonCastables) && isset($data[$field['name']]) && !empty($data[$field['name']]) && !is_array($data[$field['name']])) { |
|
| 264 | 264 | try { |
| 265 | 265 | $data[$field['name']] = json_decode($data[$field['name']]); |
| 266 | 266 | } catch (\Exception $e) { |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | */ |
| 295 | 295 | public function orderFields($order, $form = 'both') |
| 296 | 296 | { |
| 297 | - $this->transformFields($form, function ($fields) use ($order) { |
|
| 297 | + $this->transformFields($form, function($fields) use ($order) { |
|
| 298 | 298 | return $this->applyOrderToFields($fields, $order); |
| 299 | 299 | }); |
| 300 | 300 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | $id = $this->getCurrentEntryId(); |
| 43 | 43 | |
| 44 | - if (! $id) { |
|
| 44 | + if (!$id) { |
|
| 45 | 45 | return false; |
| 46 | 46 | } |
| 47 | 47 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public function getEntry($id) |
| 59 | 59 | { |
| 60 | - if (! $this->entry) { |
|
| 60 | + if (!$this->entry) { |
|
| 61 | 61 | $this->entry = $this->model->findOrFail($id); |
| 62 | 62 | $this->entry = $this->entry->withFakes(); |
| 63 | 63 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | public function hasUploadFields($form, $id = false) |
| 133 | 133 | { |
| 134 | 134 | $fields = $this->getFields($form, $id); |
| 135 | - $upload_fields = array_where($fields, function ($value, $key) { |
|
| 135 | + $upload_fields = array_where($fields, function($value, $key) { |
|
| 136 | 136 | return isset($value['upload']) && $value['upload'] == true; |
| 137 | 137 | }); |
| 138 | 138 | |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | { |
| 193 | 193 | // If the default Page Length isn't in the menu's values, Add it the beginnin and resort all to show a croissant list. |
| 194 | 194 | // assume both array are the same lenght. |
| 195 | - if (! in_array($this->getDefaultPageLength(), $this->page_length_menu[0])) { |
|
| 195 | + if (!in_array($this->getDefaultPageLength(), $this->page_length_menu[0])) { |
|
| 196 | 196 | // Loop through 2 arrays of prop. page_length_menu |
| 197 | 197 | foreach ($this->page_length_menu as $key => &$page_length_choices) { |
| 198 | 198 | // This is a condition that should be always true. |
@@ -223,9 +223,9 @@ discard block |
||
| 223 | 223 | public function getPageLengthMenu() |
| 224 | 224 | { |
| 225 | 225 | // if already set, use that |
| 226 | - if (! $this->page_length_menu) { |
|
| 226 | + if (!$this->page_length_menu) { |
|
| 227 | 227 | // try to get the menu settings from the config file |
| 228 | - if (! $this->page_length_menu = config('backpack.crud.page_length_menu')) { |
|
| 228 | + if (!$this->page_length_menu = config('backpack.crud.page_length_menu')) { |
|
| 229 | 229 | // otherwise set a sensible default |
| 230 | 230 | $this->page_length_menu = [[10, 25, 50, 100, -1], [10, 25, 50, 100, 'backpack::crud.all']]; |
| 231 | 231 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | * Upload fields are the ones that have "upload" => true defined on them. |
| 128 | 128 | * |
| 129 | 129 | * @param string $form create/update/both - defaults to 'both' |
| 130 | - * @param bool|int $id id of the entity - defaults to false |
|
| 130 | + * @param integer $id id of the entity - defaults to false |
|
| 131 | 131 | * |
| 132 | 132 | * @return bool |
| 133 | 133 | */ |
@@ -162,6 +162,7 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | /** |
| 164 | 164 | * Set the number of rows that should be show on the list view. |
| 165 | + * @param integer $value |
|
| 165 | 166 | */ |
| 166 | 167 | public function setDefaultPageLength($value) |
| 167 | 168 | { |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | | |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | - return [ |
|
| 16 | + return [ |
|
| 17 | 17 | 'infoFiltered' => '(filtered from _MAX_ total entries)', |
| 18 | 18 | 'thousands' => ',', |
| 19 | 19 | 'admin' => 'المشرف', |
@@ -25,9 +25,9 @@ |
||
| 25 | 25 | </thead> |
| 26 | 26 | <?php |
| 27 | 27 | |
| 28 | -if (! empty($_POST)) { |
|
| 28 | +if (!empty($_POST)) { |
|
| 29 | 29 | foreach ($_POST as $key => $value) { |
| 30 | - if ((! is_string($value) && ! is_numeric($value)) || ! is_string($key)) { |
|
| 30 | + if ((!is_string($value) && !is_numeric($value)) || !is_string($key)) { |
|
| 31 | 31 | continue; |
| 32 | 32 | } |
| 33 | 33 | |