@@ -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() |