@@ -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 | |
@@ -306,15 +306,15 @@ discard block |
||
| 306 | 306 | |
| 307 | 307 | // Redirect to source record if a relation was deleted |
| 308 | 308 | if (isset($relatedlist) && $request->input('id')) { |
| 309 | - $params = ['id' => $request->input('id')]; |
|
| 309 | + $params = [ 'id' => $request->input('id') ]; |
|
| 310 | 310 | |
| 311 | 311 | // Add tab id if defined to select it automaticaly |
| 312 | 312 | if ($request->input('tab')) { |
| 313 | - $params['tab'] = $request->input('tab'); |
|
| 313 | + $params[ 'tab' ] = $request->input('tab'); |
|
| 314 | 314 | } |
| 315 | 315 | // Add related list id to select the related tab automaticaly |
| 316 | 316 | else { |
| 317 | - $params['relatedlist'] = $relatedlist->id; |
|
| 317 | + $params[ 'relatedlist' ] = $relatedlist->id; |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | $route = ucroute('uccello.detail', $domain, $relatedlist->module, $params); |
@@ -48,17 +48,17 @@ discard block |
||
| 48 | 48 | // Get filters |
| 49 | 49 | $filters = Filter::where('module_id', $module->id) // Module |
| 50 | 50 | ->where('type', 'list') // Type (list) |
| 51 | - ->where(function ($query) use($domain) { // Domain |
|
| 51 | + ->where(function($query) use($domain) { // Domain |
|
| 52 | 52 | $query->whereNull('domain_id') |
| 53 | 53 | ->orWhere('domain_id', $domain->getKey()); |
| 54 | 54 | }) |
| 55 | - ->where(function ($query) { // User |
|
| 55 | + ->where(function($query) { // User |
|
| 56 | 56 | $query->where('is_public', true) |
| 57 | - ->orWhere(function ($query) { |
|
| 57 | + ->orWhere(function($query) { |
|
| 58 | 58 | $query->where('is_public', false) |
| 59 | 59 | ->where('user_id', '=', auth()->id()); |
| 60 | 60 | }) |
| 61 | - ->orWhere(function ($query) { |
|
| 61 | + ->orWhere(function($query) { |
|
| 62 | 62 | $query->where('is_public', false) |
| 63 | 63 | ->whereNull('user_id'); |
| 64 | 64 | }); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | ->get(); |
| 68 | 68 | |
| 69 | 69 | // Order |
| 70 | - $filterOrder = (array) $selectedFilter->order; |
|
| 70 | + $filterOrder = (array)$selectedFilter->order; |
|
| 71 | 71 | |
| 72 | 72 | // See descendants |
| 73 | 73 | $seeDescendants = request()->session()->get('descendants'); |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | if ($relatedList && $relatedList->method) { |
| 151 | 151 | // Related list method |
| 152 | 152 | $method = $relatedList->method; |
| 153 | - $recordIdsMethod = $method . 'RecordIds'; |
|
| 153 | + $recordIdsMethod = $method.'RecordIds'; |
|
| 154 | 154 | |
| 155 | 155 | // Get related records ids |
| 156 | 156 | $model = new $modelClass; |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | // Add the record id itself to be filtered |
| 160 | 160 | if ($relatedList->module_id === $relatedList->related_module_id && !empty($recordId) && !$filteredRecordIds->contains($recordId)) { |
| 161 | - $filteredRecordIds[] = (int)$recordId; |
|
| 161 | + $filteredRecordIds[ ] = (int)$recordId; |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | // Make the quer |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | $records = $query->paginate($length); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - $records->getCollection()->transform(function ($record) use ($domain, $module) { |
|
| 172 | + $records->getCollection()->transform(function($record) use ($domain, $module) { |
|
| 173 | 173 | foreach ($module->fields as $field) { |
| 174 | 174 | // If a special template exists, use it. Else use the generic template |
| 175 | 175 | $uitype = uitype($field->uitype_id); |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | $results = collect(); |
| 214 | 214 | if (method_exists($modelClass, 'getSearchResult') && property_exists($modelClass, 'searchableColumns')) { |
| 215 | 215 | $searchResults = new Search(); |
| 216 | - $searchResults->registerModel($modelClass, (array) (new $modelClass)->searchableColumns); |
|
| 216 | + $searchResults->registerModel($modelClass, (array)(new $modelClass)->searchableColumns); |
|
| 217 | 217 | $results = $searchResults->search($q)->take(config('uccello.max_results.autocomplete', 10)); |
| 218 | 218 | } |
| 219 | 219 | |
@@ -234,9 +234,9 @@ discard block |
||
| 234 | 234 | $savePageLength = $request->input('save_page_length'); |
| 235 | 235 | |
| 236 | 236 | // Optional data |
| 237 | - $data = []; |
|
| 237 | + $data = [ ]; |
|
| 238 | 238 | if ($savePageLength) { |
| 239 | - $data["length"] = $request->input('page_length'); |
|
| 239 | + $data[ "length" ] = $request->input('page_length'); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | $filter = Filter::firstOrNew([ |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | $builder->whereIn('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('assigned_user_id', function ($query) use ($user) { |
|
| 30 | + $builder->orWhereIn('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) |
@@ -28,11 +28,11 @@ discard block |
||
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | // Create uuid after save |
| 31 | - static::created(function ($model) { |
|
| 31 | + static::created(function($model) { |
|
| 32 | 32 | $module = Module::where('model_class', get_class($model))->first(); |
| 33 | 33 | if ($module) { |
| 34 | 34 | Entity::create([ |
| 35 | - 'id' => (string) Str::uuid(), |
|
| 35 | + 'id' => (string)Str::uuid(), |
|
| 36 | 36 | 'module_id' => $module->id, |
| 37 | 37 | 'record_id' => $model->getKey(), |
| 38 | 38 | 'creator_id' => auth()->id(), |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | }); |
| 42 | 42 | |
| 43 | 43 | // Delete uuid after forced delete |
| 44 | - static::deleted(function ($model) { |
|
| 44 | + static::deleted(function($model) { |
|
| 45 | 45 | if (!empty($model->uuid) && (!method_exists($model, 'isForceDeleting') || $model->isForceDeleting() === true)) { |
| 46 | 46 | $entity = Entity::find($model->uuid); |
| 47 | 47 | if ($entity) { |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | public function initializeUccelloModule() |
| 55 | 55 | { |
| 56 | - $this->appends = array_merge($this->appends, ['recordLabel','uuid']); |
|
| 56 | + $this->appends = array_merge($this->appends, [ 'recordLabel', 'uuid' ]); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | protected static function isFilteredByUser() |
@@ -85,15 +85,15 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | protected static function getModuleFromClass($className) |
| 87 | 87 | { |
| 88 | - $modules = Cache::rememberForever('modules_by_model_class', function () { |
|
| 88 | + $modules = Cache::rememberForever('modules_by_model_class', function() { |
|
| 89 | 89 | $modulesGroupedByModelClass = collect(); |
| 90 | - Module::all()->map(function ($item) use ($modulesGroupedByModelClass) { |
|
| 91 | - $modulesGroupedByModelClass[$item->model_class] = $item; |
|
| 90 | + Module::all()->map(function($item) use ($modulesGroupedByModelClass) { |
|
| 91 | + $modulesGroupedByModelClass[ $item->model_class ] = $item; |
|
| 92 | 92 | return $modulesGroupedByModelClass; |
| 93 | 93 | }); |
| 94 | 94 | return $modulesGroupedByModelClass; |
| 95 | 95 | }); |
| 96 | - return $modules[(string) $className] ?? null; |
|
| 96 | + return $modules[ (string)$className ] ?? null; |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | public function getUuidAttribute() |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | parent::boot(); |
| 68 | 68 | |
| 69 | 69 | // Linck to parent record |
| 70 | - static::created(function ($model) { |
|
| 70 | + static::created(function($model) { |
|
| 71 | 71 | static::linkToParentRecord($model); |
| 72 | 72 | }); |
| 73 | 73 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | // static::linkToParentRecord($model); |
| 76 | 76 | // }); |
| 77 | 77 | |
| 78 | - static::updated(function ($model) { |
|
| 78 | + static::updated(function($model) { |
|
| 79 | 79 | static::linkToParentRecord($model); |
| 80 | 80 | }); |
| 81 | 81 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | public function isRoot() |
| 104 | 104 | { |
| 105 | 105 | // return (empty($this->{$this->getTreeColumn('parent')})) ? true : false; |
| 106 | - return $this->{$this->getTreeColumn('path')} === $this->getKey() . '/' |
|
| 106 | + return $this->{$this->getTreeColumn('path')} === $this->getKey().'/' |
|
| 107 | 107 | && $this->{$this->getTreeColumn('level')} === 0; |
| 108 | 108 | } |
| 109 | 109 | |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | */ |
| 234 | 234 | protected function getNotAdminModulesAttribute() : array |
| 235 | 235 | { |
| 236 | - return Cache::rememberForever('not_admin_modules', function () { |
|
| 236 | + return Cache::rememberForever('not_admin_modules', function() { |
|
| 237 | 237 | $modules = [ ]; |
| 238 | 238 | |
| 239 | 239 | foreach ($this->modules()->get() as $module) { |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | parent::boot(); |
| 53 | 53 | |
| 54 | 54 | // Linck to parent record |
| 55 | - static::created(function ($model) { |
|
| 55 | + static::created(function($model) { |
|
| 56 | 56 | static::linkToParentRecord($model); |
| 57 | 57 | }); |
| 58 | 58 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | // static::linkToParentRecord($model); |
| 61 | 61 | // }); |
| 62 | 62 | |
| 63 | - static::updated(function ($model) { |
|
| 63 | + static::updated(function($model) { |
|
| 64 | 64 | static::linkToParentRecord($model); |
| 65 | 65 | }); |
| 66 | 66 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | public function isRoot() |
| 88 | 88 | { |
| 89 | 89 | // return (empty($this->{$this->getTreeColumn('parent')})) ? true : false; |
| 90 | - return $this->{$this->getTreeColumn('path')} === $this->getKey() . '/' |
|
| 90 | + return $this->{$this->getTreeColumn('path')} === $this->getKey().'/' |
|
| 91 | 91 | && $this->{$this->getTreeColumn('level')} === 0; |
| 92 | 92 | } |
| 93 | 93 | |
@@ -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 | |