@@ -25,11 +25,11 @@ |
||
| 25 | 25 | 'creator_id', |
| 26 | 26 | ]; |
| 27 | 27 | |
| 28 | - protected $primaryKey = 'id'; // TODO: Change to "uid" to make joins withs modules tables possible ??? |
|
| 28 | + protected $primaryKey = 'id'; // TODO: Change to "uid" to make joins withs modules tables possible ??? |
|
| 29 | 29 | public $incrementing = false; |
| 30 | 30 | |
| 31 | 31 | // Allow Eloquent to return id as string instead of int. |
| 32 | - protected $casts = ['id' => 'string']; |
|
| 32 | + protected $casts = [ 'id' => 'string' ]; |
|
| 33 | 33 | |
| 34 | 34 | protected function initTablePrefix() |
| 35 | 35 | { |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | public function getFormattedValueToDisplay(Field $field, $record) : string |
| 76 | 76 | { |
| 77 | 77 | if (isset($field->data->multiple) && $field->data->multiple === true && !empty($record->{$field->column})) { |
| 78 | - $values = []; |
|
| 78 | + $values = [ ]; |
|
| 79 | 79 | |
| 80 | 80 | $fieldValues = json_decode($record->{$field->column}); |
| 81 | 81 | if (is_array($fieldValues)) { |
@@ -84,13 +84,13 @@ discard block |
||
| 84 | 84 | continue; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - $values[] = uctrans($value, $field->module); |
|
| 87 | + $values[ ] = uctrans($value, $field->module); |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $value = implode(', ', $values); |
| 92 | 92 | } else { |
| 93 | - $value = parent::getFormattedValueToDisplay($field, $record); |
|
| 93 | + $value = parent::getFormattedValueToDisplay($field, $record); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | return $value; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | $roots = collect(); |
| 61 | 61 | foreach ($rootRecords as $record) { |
| 62 | - $roots[] = $this->getFormattedRecordToAdd($record); |
|
| 62 | + $roots[ ] = $this->getFormattedRecordToAdd($record); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | return $roots; |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $children = collect(); |
| 86 | 86 | if ($parentRecord) { |
| 87 | 87 | foreach ($parentRecord->children()->get() as $record) { |
| 88 | - $children[] = $this->getFormattedRecordToAdd($record); |
|
| 88 | + $children[ ] = $this->getFormattedRecordToAdd($record); |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | @if ($value) |
| 17 | 17 | <?php |
| 18 | 18 | $valueParts = explode(';', $value); |
| 19 | - $fileName = $valueParts[0]; |
|
| 19 | + $fileName = $valueParts[ 0 ]; |
|
| 20 | 20 | ?> |
| 21 | 21 | <div class="input-field current-file"> |
| 22 | 22 | <div class="file-container"> |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | foreach ($treeDomainsIds as $treeDomainId) { |
| 45 | 45 | $_domain = Domain::find($treeDomainId); |
| 46 | 46 | foreach ($_domain->roles as $role) { |
| 47 | - $roleName = $_domain->id === $domain->id ? $role->name : $_domain->name . ' > ' . $role->name; |
|
| 47 | + $roleName = $_domain->id === $domain->id ? $role->name : $_domain->name.' > '.$role->name; |
|
| 48 | 48 | $roles[ $role->id ] = $roleName; |
| 49 | 49 | } |
| 50 | 50 | } |
@@ -176,8 +176,8 @@ |
||
| 176 | 176 | } |
| 177 | 177 | // Several routes |
| 178 | 178 | elseif (is_array($this->data->menu)) { |
| 179 | - if (!empty($this->data->menu[0]->route)) { |
|
| 180 | - $defaultRoute = $this->data->menu[0]->route; |
|
| 179 | + if (!empty($this->data->menu[ 0 ]->route)) { |
|
| 180 | + $defaultRoute = $this->data->menu[ 0 ]->route; |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | $builder->whereIn($model->getTable().'.assigned_user_id', $user->getAllowedGroupUuids()); |
| 28 | 28 | |
| 29 | 29 | // Records assigned to an user with roles subordonate to the roles of the user |
| 30 | - $builder->orWhereIn($model->getTable().'.assigned_user_id', function ($query) use ($user) { |
|
| 30 | + $builder->orWhereIn($model->getTable().'.assigned_user_id', function($query) use ($user) { |
|
| 31 | 31 | $entityTable = with(new Entity)->getTable(); |
| 32 | 32 | $privilegesTable = env('UCCELLO_TABLE_PREFIX', 'uccello_').'privileges'; |
| 33 | 33 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | $query->select($entityTable.'.id') |
| 38 | 38 | ->from($entityTable) |
| 39 | - ->join($privilegesTable, function ($join) use($entityTable, $privilegesTable, $subordonateRolesIds) { |
|
| 39 | + ->join($privilegesTable, function($join) use($entityTable, $privilegesTable, $subordonateRolesIds) { |
|
| 40 | 40 | $join->on("$privilegesTable.user_id", '=', $entityTable.'.record_id') |
| 41 | 41 | ->whereIn("$privilegesTable.role_id", $subordonateRolesIds); |
| 42 | 42 | }) |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | // Records created by the user |
| 47 | 47 | if (!empty($model->module)) { |
| 48 | - $builder->orWhereIn($model->getTable().'.'.$model->getKeyName(), function ($query) use($model) { |
|
| 48 | + $builder->orWhereIn($model->getTable().'.'.$model->getKeyName(), function($query) use($model) { |
|
| 49 | 49 | $query->select('record_id') |
| 50 | 50 | ->from(with(new Entity)->getTable()) |
| 51 | 51 | ->where('module_id', $model->module->id ?? null) |
@@ -74,9 +74,9 @@ |
||
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | // Redirect if form not valid |
| 77 | - if (! $form->isValid()) { |
|
| 77 | + if (!$form->isValid()) { |
|
| 78 | 78 | ucnotify(uctrans('notification.form.not_valid', $module), 'error'); |
| 79 | - $response = redirect(route('uccello.popup.edit', ['domain' => $domain->slug, 'module' => $module->name])); |
|
| 79 | + $response = redirect(route('uccello.popup.edit', [ 'domain' => $domain->slug, 'module' => $module->name ])); |
|
| 80 | 80 | $response = $response->withErrors($form->getErrors(), $form->getErrorBag())->withInput(); |
| 81 | 81 | return $response; |
| 82 | 82 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $this->preProcess($domain, $module, $request); |
| 161 | 161 | |
| 162 | 162 | // Retrieve record |
| 163 | - $recordId = (int) request('id'); |
|
| 163 | + $recordId = (int)request('id'); |
|
| 164 | 164 | $modelClass = $module->model_class; |
| 165 | 165 | $record = $modelClass::onlyTrashed()->findOrFail($recordId); |
| 166 | 166 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | // Redirect to the trash list |
| 175 | - $route = ucroute('uccello.list', $domain, $module, ['filter' => 'trash']); |
|
| 175 | + $route = ucroute('uccello.list', $domain, $module, [ 'filter' => 'trash' ]); |
|
| 176 | 176 | return redirect($route); |
| 177 | 177 | } |
| 178 | 178 | |
@@ -288,9 +288,9 @@ discard block |
||
| 288 | 288 | |
| 289 | 289 | if ($record) { |
| 290 | 290 | $relation = $record->$relationName(); |
| 291 | - if ($relatedList->type=='n-n') { |
|
| 291 | + if ($relatedList->type == 'n-n') { |
|
| 292 | 292 | $relation->attach($relatedRecordId); |
| 293 | - } elseif ($relatedList->type=='n-1') { |
|
| 293 | + } elseif ($relatedList->type == 'n-1') { |
|
| 294 | 294 | $relatedModelClass = $relatedList->relatedModule->model_class; |
| 295 | 295 | $related_record = $relatedModelClass::find($relatedRecordId); |
| 296 | 296 | $relation->save($related_record); |
@@ -316,15 +316,15 @@ discard block |
||
| 316 | 316 | |
| 317 | 317 | // Redirect to source record if a relation was deleted |
| 318 | 318 | if (isset($relatedlist) && $request->input('id')) { |
| 319 | - $params = ['id' => $request->input('id')]; |
|
| 319 | + $params = [ 'id' => $request->input('id') ]; |
|
| 320 | 320 | |
| 321 | 321 | // Add tab id if defined to select it automaticaly |
| 322 | 322 | if ($request->input('tab')) { |
| 323 | - $params['tab'] = $request->input('tab'); |
|
| 323 | + $params[ 'tab' ] = $request->input('tab'); |
|
| 324 | 324 | } |
| 325 | 325 | // Add related list id to select the related tab automaticaly |
| 326 | 326 | else { |
| 327 | - $params['relatedlist'] = $relatedlist->id; |
|
| 327 | + $params[ 'relatedlist' ] = $relatedlist->id; |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | $route = ucroute('uccello.detail', $domain, $relatedlist->module, $params); |