@@ -274,15 +274,15 @@ |
||
| 274 | 274 | |
| 275 | 275 | // Redirect to source record if a relation was deleted |
| 276 | 276 | if (isset($relatedlist) && $request->input('id')) { |
| 277 | - $params = ['id' => $request->input('id')]; |
|
| 277 | + $params = [ 'id' => $request->input('id') ]; |
|
| 278 | 278 | |
| 279 | 279 | // Add tab id if defined to select it automaticaly |
| 280 | 280 | if ($request->input('tab')) { |
| 281 | - $params['tab'] = $request->input('tab'); |
|
| 281 | + $params[ 'tab' ] = $request->input('tab'); |
|
| 282 | 282 | } |
| 283 | 283 | // Add related list id to select the related tab automaticaly |
| 284 | 284 | else { |
| 285 | - $params['relatedlist'] = $relatedlist->id; |
|
| 285 | + $params[ 'relatedlist' ] = $relatedlist->id; |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | $route = ucroute('uccello.detail', $domain, $relatedlist->module, $params); |
@@ -3,9 +3,9 @@ |
||
| 3 | 3 | <?php |
| 4 | 4 | $autocompleteSearch = false; |
| 5 | 5 | |
| 6 | - $entities = []; |
|
| 6 | + $entities = [ ]; |
|
| 7 | 7 | |
| 8 | - if (isset($column['data']->autocomplete_search) && $column['data']->autocomplete_search === true) { |
|
| 8 | + if (isset($column[ 'data' ]->autocomplete_search) && $column[ 'data' ]->autocomplete_search === true) { |
|
| 9 | 9 | $autocompleteSearch = true; |
| 10 | 10 | } else { |
| 11 | 11 | $entities = auth()->user()->getAllowedGroupsAndUsers(false); |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | |
| 64 | 64 | // Create uuid |
| 65 | 65 | Entity::create([ |
| 66 | - 'id' => (string) Str::uuid(), |
|
| 66 | + 'id' => (string)Str::uuid(), |
|
| 67 | 67 | 'module_id' => ucmodule('user')->id, |
| 68 | 68 | 'record_id' => $user->getKey(), |
| 69 | 69 | ]); |
@@ -109,8 +109,8 @@ |
||
| 109 | 109 | */ |
| 110 | 110 | public function addConditionToSearchQuery(Builder $query, Field $field, $value) : Builder |
| 111 | 111 | { |
| 112 | - $query->where(function ($query) use($field, $value) { |
|
| 113 | - foreach ((array) $value as $_value) { |
|
| 112 | + $query->where(function($query) use($field, $value) { |
|
| 113 | + foreach ((array)$value as $_value) { |
|
| 114 | 114 | // Replace me by connected user's id |
| 115 | 115 | if ($_value === 'me') { |
| 116 | 116 | $_value = Auth::user()->uuid; |
@@ -123,7 +123,7 @@ |
||
| 123 | 123 | protected function isEmptyOrNotEmptySearchQuery(Builder &$query, Field $field, $value): bool |
| 124 | 124 | { |
| 125 | 125 | if ($value == uctrans('filter.search_flag.empty', $field->module)) { |
| 126 | - $query->where(function ($q) use ($field) { |
|
| 126 | + $query->where(function($q) use ($field) { |
|
| 127 | 127 | $q->whereNull($field->column) |
| 128 | 128 | ->orWhere($field->column, '=', ''); |
| 129 | 129 | }); |
@@ -130,7 +130,7 @@ |
||
| 130 | 130 | if (method_exists($modelClass, 'getSearchResult') && property_exists($modelClass, 'searchableColumns')) { |
| 131 | 131 | // Search related records and get all ids |
| 132 | 132 | $searchResults = new Search(); |
| 133 | - $searchResults->registerModel($modelClass, (array) (new $modelClass)->searchableColumns); |
|
| 133 | + $searchResults->registerModel($modelClass, (array)(new $modelClass)->searchableColumns); |
|
| 134 | 134 | $recordIds = $searchResults->search($value)->pluck('searchable.id'); |
| 135 | 135 | |
| 136 | 136 | // Search records linked to record ids got previously |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | ]; |
| 59 | 59 | |
| 60 | 60 | // We want the field displays the datetime in the good format |
| 61 | - $options['value'] = $this->getFormattedValueToDisplay($field, $record); |
|
| 61 | + $options[ 'value' ] = $this->getFormattedValueToDisplay($field, $record); |
|
| 62 | 62 | |
| 63 | 63 | return $options; |
| 64 | 64 | } |
@@ -123,10 +123,10 @@ discard block |
||
| 123 | 123 | public function addConditionToSearchQuery(Builder $query, Field $field, $value) : Builder |
| 124 | 124 | { |
| 125 | 125 | if (!$this->isEmptyOrNotEmptySearchQuery($query, $field, $value)) { |
| 126 | - $query->where(function ($query) use($field, $value) { |
|
| 126 | + $query->where(function($query) use($field, $value) { |
|
| 127 | 127 | $values = explode(',', $value); // Start Date, End Date |
| 128 | - $dateStart = \Carbon\Carbon::createFromFormat(config('uccello.format.php.datetime'), trim($values[0])); |
|
| 129 | - $dateEnd = \Carbon\Carbon::createFromFormat(config('uccello.format.php.datetime'), trim($values[1])); |
|
| 128 | + $dateStart = \Carbon\Carbon::createFromFormat(config('uccello.format.php.datetime'), trim($values[ 0 ])); |
|
| 129 | + $dateEnd = \Carbon\Carbon::createFromFormat(config('uccello.format.php.datetime'), trim($values[ 1 ])); |
|
| 130 | 130 | $query->whereBetween($field->column, [ $dateStart, $dateEnd ])->get(); |
| 131 | 131 | }); |
| 132 | 132 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | ]; |
| 46 | 46 | |
| 47 | 47 | // We want the field displays the date in the good format |
| 48 | - $options['value'] = $this->getFormattedValueToDisplay($field, $record); |
|
| 48 | + $options[ 'value' ] = $this->getFormattedValueToDisplay($field, $record); |
|
| 49 | 49 | |
| 50 | 50 | return $options; |
| 51 | 51 | } |
@@ -110,10 +110,10 @@ discard block |
||
| 110 | 110 | public function addConditionToSearchQuery(Builder $query, Field $field, $value) : Builder |
| 111 | 111 | { |
| 112 | 112 | if (!$this->isEmptyOrNotEmptySearchQuery($query, $field, $value)) { |
| 113 | - $query->where(function ($query) use($field, $value) { |
|
| 113 | + $query->where(function($query) use($field, $value) { |
|
| 114 | 114 | $values = explode(',', $value); // Start Date, End Date |
| 115 | - $dateStart = \Carbon\Carbon::createFromFormat(config('uccello.format.php.date'), trim($values[0])); |
|
| 116 | - $dateEnd = \Carbon\Carbon::createFromFormat(config('uccello.format.php.date'), trim($values[1])); |
|
| 115 | + $dateStart = \Carbon\Carbon::createFromFormat(config('uccello.format.php.date'), trim($values[ 0 ])); |
|
| 116 | + $dateEnd = \Carbon\Carbon::createFromFormat(config('uccello.format.php.date'), trim($values[ 1 ])); |
|
| 117 | 117 | $query->whereBetween($field->column, [ $dateStart, $dateEnd ])->get(); |
| 118 | 118 | }); |
| 119 | 119 | } |
@@ -44,9 +44,9 @@ discard block |
||
| 44 | 44 | public function down() |
| 45 | 45 | { |
| 46 | 46 | // Drop table |
| 47 | - Schema::dropIfExists($this->tablePrefix . 'uccello_groups'); |
|
| 48 | - Schema::dropIfExists($this->tablePrefix . 'uccello_rl_groups_groups'); |
|
| 49 | - Schema::dropIfExists($this->tablePrefix . 'uccello_rl_groups_users'); |
|
| 47 | + Schema::dropIfExists($this->tablePrefix.'uccello_groups'); |
|
| 48 | + Schema::dropIfExists($this->tablePrefix.'uccello_rl_groups_groups'); |
|
| 49 | + Schema::dropIfExists($this->tablePrefix.'uccello_rl_groups_users'); |
|
| 50 | 50 | |
| 51 | 51 | // Delete module |
| 52 | 52 | Module::where('name', 'group')->forceDelete(); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | protected function createTables() |
| 56 | 56 | { |
| 57 | 57 | // Module Table |
| 58 | - Schema::create($this->tablePrefix . 'uccello_groups', function (Blueprint $table) { |
|
| 58 | + Schema::create($this->tablePrefix.'uccello_groups', function(Blueprint $table) { |
|
| 59 | 59 | $table->increments('id'); |
| 60 | 60 | $table->string('name')->nullable(); |
| 61 | 61 | $table->text('description')->nullable(); |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | }); |
| 67 | 67 | |
| 68 | 68 | // Related List Table: Groups-Groups |
| 69 | - Schema::create($this->tablePrefix . 'uccello_rl_groups_groups', function (Blueprint $table) { |
|
| 69 | + Schema::create($this->tablePrefix.'uccello_rl_groups_groups', function(Blueprint $table) { |
|
| 70 | 70 | $table->increments('id'); |
| 71 | 71 | $table->unsignedInteger('parent_id'); |
| 72 | 72 | $table->unsignedInteger('children_id'); |
@@ -74,19 +74,19 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | // Foreign keys |
| 76 | 76 | $table->foreign('parent_id') |
| 77 | - ->references('id')->on($this->tablePrefix . 'uccello_groups') |
|
| 77 | + ->references('id')->on($this->tablePrefix.'uccello_groups') |
|
| 78 | 78 | ->onDelete('cascade'); |
| 79 | 79 | |
| 80 | 80 | $table->foreign('children_id') |
| 81 | - ->references('id')->on($this->tablePrefix . 'uccello_groups') |
|
| 81 | + ->references('id')->on($this->tablePrefix.'uccello_groups') |
|
| 82 | 82 | ->onDelete('cascade'); |
| 83 | 83 | |
| 84 | 84 | // Unique keys |
| 85 | - $table->unique(['parent_id', 'children_id']); |
|
| 85 | + $table->unique([ 'parent_id', 'children_id' ]); |
|
| 86 | 86 | }); |
| 87 | 87 | |
| 88 | 88 | // Related List Table: Groups-Users |
| 89 | - Schema::create($this->tablePrefix . 'uccello_rl_groups_users', function (Blueprint $table) { |
|
| 89 | + Schema::create($this->tablePrefix.'uccello_rl_groups_users', function(Blueprint $table) { |
|
| 90 | 90 | $table->increments('id'); |
| 91 | 91 | $table->unsignedInteger('group_id'); |
| 92 | 92 | $table->unsignedInteger('user_id'); |
@@ -94,15 +94,15 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | // Foreign keys |
| 96 | 96 | $table->foreign('group_id') |
| 97 | - ->references('id')->on($this->tablePrefix . 'uccello_groups') |
|
| 97 | + ->references('id')->on($this->tablePrefix.'uccello_groups') |
|
| 98 | 98 | ->onDelete('cascade'); |
| 99 | 99 | |
| 100 | 100 | $table->foreign('user_id') |
| 101 | - ->references('id')->on($this->tablePrefix . 'users') |
|
| 101 | + ->references('id')->on($this->tablePrefix.'users') |
|
| 102 | 102 | ->onDelete('cascade'); |
| 103 | 103 | |
| 104 | 104 | // Unique keys |
| 105 | - $table->unique(['group_id', 'user_id']); |
|
| 105 | + $table->unique([ 'group_id', 'user_id' ]); |
|
| 106 | 106 | }); |
| 107 | 107 | } |
| 108 | 108 | |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $filter->user_id = null; |
| 169 | 169 | $filter->name = 'filter.all'; |
| 170 | 170 | $filter->type = 'list'; |
| 171 | - $filter->columns = [ 'name', 'description']; |
|
| 171 | + $filter->columns = [ 'name', 'description' ]; |
|
| 172 | 172 | $filter->conditions = null; |
| 173 | 173 | $filter->order_by = null; |
| 174 | 174 | $filter->is_default = true; |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | 'method' => 'getRelatedList', |
| 201 | 201 | 'data' => [ |
| 202 | 202 | "relationName" => "childrenGroups", |
| 203 | - "actions" => ["select", "add"] |
|
| 203 | + "actions" => [ "select", "add" ] |
|
| 204 | 204 | ], |
| 205 | 205 | 'sequence' => 0 |
| 206 | 206 | ]); |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | 'label' => 'relatedlist.users', |
| 218 | 218 | 'type' => 'n-n', |
| 219 | 219 | 'method' => 'getRelatedList', |
| 220 | - 'data' => ["actions" => ["select", "add"]], |
|
| 220 | + 'data' => [ "actions" => [ "select", "add" ] ], |
|
| 221 | 221 | 'sequence' => 1 |
| 222 | 222 | ]); |
| 223 | 223 | } |