@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | { |
19 | 19 | $routeName = 'admin.form.element.dependent-select'; |
20 | 20 | |
21 | - if (! $router->has($routeName)) { |
|
22 | - $router->post('{adminModel}/dependent-select/{field}/{id?}', ['as' => $routeName, function ( |
|
21 | + if (!$router->has($routeName)) { |
|
22 | + $router->post('{adminModel}/dependent-select/{field}/{id?}', [ 'as' => $routeName, function( |
|
23 | 23 | Request $request, |
24 | 24 | ModelConfigurationInterface $model, |
25 | 25 | $field, |
26 | 26 | $id = null |
27 | 27 | ) { |
28 | 28 | |
29 | - if (! is_null($id)) { |
|
29 | + if (!is_null($id)) { |
|
30 | 30 | $item = $model->getRepository()->find($id); |
31 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
31 | + if (is_null($item) || !$model->isEditable($item)) { |
|
32 | 32 | return new JsonResponse([ |
33 | 33 | 'message' => trans('lang.message.access_denied'), |
34 | 34 | ], 403); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | $form = $model->fireEdit($id); |
38 | 38 | } else { |
39 | - if (! $model->isCreatable()) { |
|
39 | + if (!$model->isCreatable()) { |
|
40 | 40 | return new JsonResponse([ |
41 | 41 | 'message' => trans('lang.message.access_denied'), |
42 | 42 | ], 403); |
@@ -52,24 +52,24 @@ discard block |
||
52 | 52 | } |
53 | 53 | |
54 | 54 | $element->setAjaxParameters( |
55 | - $request->input('depdrop_all_params', []) |
|
55 | + $request->input('depdrop_all_params', [ ]) |
|
56 | 56 | ); |
57 | 57 | |
58 | 58 | $options = $element->getOptions(); |
59 | 59 | |
60 | 60 | if ($element->isNullable()) { |
61 | - $options = [null => trans('sleeping_owl::lang.select.nothing')] + $options; |
|
61 | + $options = [ null => trans('sleeping_owl::lang.select.nothing') ] + $options; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | $options = array_except($options, $element->exclude); |
65 | 65 | |
66 | 66 | return new JsonResponse([ |
67 | 67 | 'output' => collect($options)->map(function($value, $key) { |
68 | - return ['id' => $key, 'name' => $value]; |
|
68 | + return [ 'id' => $key, 'name' => $value ]; |
|
69 | 69 | }), |
70 | 70 | 'selected' => $element->getValue() |
71 | 71 | ]); |
72 | - }]); |
|
72 | + } ]); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | /** |
82 | 82 | * @var array |
83 | 83 | */ |
84 | - protected $dataDepends = []; |
|
84 | + protected $dataDepends = [ ]; |
|
85 | 85 | |
86 | 86 | /** |
87 | 87 | * @var array |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | * @param null $label |
96 | 96 | * @param array $depends |
97 | 97 | */ |
98 | - public function __construct($path, $label = null, array $depends = []) |
|
98 | + public function __construct($path, $label = null, array $depends = [ ]) |
|
99 | 99 | { |
100 | - parent::__construct($path, $label, []); |
|
100 | + parent::__construct($path, $label, [ ]); |
|
101 | 101 | |
102 | 102 | $this->setDataDepends($depends); |
103 | 103 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | ]; |
184 | 184 | |
185 | 185 | if ($this->isReadonly()) { |
186 | - $attributes['disabled'] = 'disabled'; |
|
186 | + $attributes[ 'disabled' ] = 'disabled'; |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | return [ |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | public function getValue() |
50 | 50 | { |
51 | 51 | $value = parent::getValue(); |
52 | - if (! empty($value)) { |
|
52 | + if (!empty($value)) { |
|
53 | 53 | return $this->parseValue($value); |
54 | 54 | } |
55 | 55 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function setValue(Model $model, $attribute, $value) |
83 | 83 | { |
84 | - $value = ! empty($value) ? Carbon::createFromFormat($this->getPickerFormat(), $value)->format($this->getFormat()) : null; |
|
84 | + $value = !empty($value) ? Carbon::createFromFormat($this->getPickerFormat(), $value)->format($this->getFormat()) : null; |
|
85 | 85 | |
86 | 86 | parent::setValue($model, $attribute, $value); |
87 | 87 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | public function storeAsJson() |
14 | 14 | { |
15 | - $this->mutateValue(function ($value) { |
|
15 | + $this->mutateValue(function($value) { |
|
16 | 16 | return json_encode($value); |
17 | 17 | }); |
18 | 18 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function storeAsComaSeparatedValue() |
28 | 28 | { |
29 | - $this->mutateValue(function ($value) { |
|
29 | + $this->mutateValue(function($value) { |
|
30 | 30 | return implode(',', $value); |
31 | 31 | }); |
32 | 32 | |
@@ -38,13 +38,13 @@ discard block |
||
38 | 38 | $name = $this->getName(); |
39 | 39 | $value = Request::input($name, ''); |
40 | 40 | |
41 | - if (! empty($value)) { |
|
41 | + if (!empty($value)) { |
|
42 | 42 | $value = explode(',', $value); |
43 | 43 | } else { |
44 | - $value = []; |
|
44 | + $value = [ ]; |
|
45 | 45 | } |
46 | 46 | |
47 | - Request::merge([$name => $value]); |
|
47 | + Request::merge([ $name => $value ]); |
|
48 | 48 | parent::save(); |
49 | 49 | } |
50 | 50 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | { |
56 | 56 | $value = parent::getValue(); |
57 | 57 | if (is_null($value)) { |
58 | - $value = []; |
|
58 | + $value = [ ]; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | if (is_string($value)) { |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | ]; |
97 | 97 | |
98 | 98 | if ($this->isTaggable()) { |
99 | - $attributes['class'] .= ' input-taggable'; |
|
99 | + $attributes[ 'class' ] .= ' input-taggable'; |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | if ($this->isReadonly()) { |
103 | - $attributes['disabled'] = 'disabled'; |
|
103 | + $attributes[ 'disabled' ] = 'disabled'; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | return [ |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $attribute = $this->getAttribute(); |
126 | 126 | |
127 | 127 | if (is_null(Request::input($this->getPath()))) { |
128 | - $values = []; |
|
128 | + $values = [ ]; |
|
129 | 129 | } else { |
130 | 130 | $values = $this->getValue(); |
131 | 131 | } |
@@ -134,19 +134,19 @@ discard block |
||
134 | 134 | |
135 | 135 | if ($relation instanceof \Illuminate\Database\Eloquent\Relations\BelongsToMany) { |
136 | 136 | foreach ($values as $i => $value) { |
137 | - if (! array_key_exists($value, $this->getOptions()) and $this->isTaggable()) { |
|
137 | + if (!array_key_exists($value, $this->getOptions()) and $this->isTaggable()) { |
|
138 | 138 | $model = clone $this->getModelForOptions(); |
139 | 139 | $model->{$this->getDisplay()} = $value; |
140 | 140 | $model->save(); |
141 | 141 | |
142 | - $values[$i] = $model->getKey(); |
|
142 | + $values[ $i ] = $model->getKey(); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
146 | 146 | $relation->sync($values); |
147 | 147 | } elseif ($relation instanceof \Illuminate\Database\Eloquent\Relations\HasMany) { |
148 | 148 | foreach ($relation->get() as $item) { |
149 | - if (! in_array($item->getKey(), $values)) { |
|
149 | + if (!in_array($item->getKey(), $values)) { |
|
150 | 150 | if ($this->isDeleteRelatedItem()) { |
151 | 151 | $item->delete(); |
152 | 152 | } else { |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $item = $model->find($value); |
163 | 163 | |
164 | 164 | if (is_null($item)) { |
165 | - if (! $this->isTaggable()) { |
|
165 | + if (!$this->isTaggable()) { |
|
166 | 166 | continue; |
167 | 167 | } |
168 | 168 |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | { |
14 | 14 | $value = $this->getValue(); |
15 | 15 | |
16 | - if (! $this->isAllowedEmptyValue() and $this->getModel()->exists() and empty($value)) { |
|
16 | + if (!$this->isAllowedEmptyValue() and $this->getModel()->exists() and empty($value)) { |
|
17 | 17 | return; |
18 | 18 | } |
19 | 19 | |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | { |
28 | 28 | $data = parent::getValidationRules(); |
29 | 29 | |
30 | - if (! $this->isAllowedEmptyValue() and $this->getModel()->exists()) { |
|
30 | + if (!$this->isAllowedEmptyValue() and $this->getModel()->exists()) { |
|
31 | 31 | foreach ($data as $field => $rules) { |
32 | 32 | foreach ($rules as $i => $rule) { |
33 | 33 | if ($rule == 'required') { |
34 | - unset($data[$field][$i]); |
|
34 | + unset($data[ $field ][ $i ]); |
|
35 | 35 | } |
36 | 36 | } |
37 | 37 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function hashWithBcrypt() |
65 | 65 | { |
66 | - return $this->mutateValue(function ($value) { |
|
66 | + return $this->mutateValue(function($value) { |
|
67 | 67 | return bcrypt($value); |
68 | 68 | }); |
69 | 69 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function hashWithMD5() |
75 | 75 | { |
76 | - return $this->mutateValue(function ($value) { |
|
76 | + return $this->mutateValue(function($value) { |
|
77 | 77 | return md5($value); |
78 | 78 | }); |
79 | 79 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function hashWithSHA1() |
85 | 85 | { |
86 | - return $this->mutateValue(function ($value) { |
|
86 | + return $this->mutateValue(function($value) { |
|
87 | 87 | return sha1($value); |
88 | 88 | }); |
89 | 89 | } |
@@ -91,7 +91,7 @@ |
||
91 | 91 | */ |
92 | 92 | public function getConditionAttributes(Model $model) |
93 | 93 | { |
94 | - $temp = $this->attributeCondition ? call_user_func($this->attributeCondition, $model) : []; |
|
94 | + $temp = $this->attributeCondition ? call_user_func($this->attributeCondition, $model) : [ ]; |
|
95 | 95 | |
96 | 96 | if ($temp) { |
97 | 97 | foreach ($temp as $key => $value) { |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function set($filters) |
42 | 42 | { |
43 | - if (! is_array($filters)) { |
|
43 | + if (!is_array($filters)) { |
|
44 | 44 | $filters = func_get_args(); |
45 | 45 | } |
46 | 46 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function getActive() |
80 | 80 | { |
81 | - return $this->filters->filter(function (FilterInterface $filter) { |
|
81 | + return $this->filters->filter(function(FilterInterface $filter) { |
|
82 | 82 | return $filter->isActive(); |
83 | 83 | }); |
84 | 84 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function modifyQuery(\Illuminate\Database\Eloquent\Builder $query) |
126 | 126 | { |
127 | - $this->getActive()->each(function (FilterInterface $filter) use ($query) { |
|
127 | + $this->getActive()->each(function(FilterInterface $filter) use ($query) { |
|
128 | 128 | $filter->apply($query); |
129 | 129 | }); |
130 | 130 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function initialize() |
136 | 136 | { |
137 | - $this->filters->each(function (FilterInterface $filter) { |
|
137 | + $this->filters->each(function(FilterInterface $filter) { |
|
138 | 138 | $filter->initialize(); |
139 | 139 | }); |
140 | 140 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | { |
36 | 36 | $this->setName($name); |
37 | 37 | |
38 | - if (! is_null($title)) { |
|
38 | + if (!is_null($title)) { |
|
39 | 39 | $this->setTitle($title); |
40 | 40 | } |
41 | 41 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function getAlias() |
79 | 79 | { |
80 | - if (! $this->alias) { |
|
80 | + if (!$this->alias) { |
|
81 | 81 | return $this->getName(); |
82 | 82 | } |
83 | 83 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | return call_user_func($this->title, $this->getValue()); |
110 | 110 | } |
111 | 111 | |
112 | - return strtr($this->title, [':value' => $this->getValue()]); |
|
112 | + return strtr($this->title, [ ':value' => $this->getValue() ]); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -149,6 +149,6 @@ discard block |
||
149 | 149 | */ |
150 | 150 | public function isActive() |
151 | 151 | { |
152 | - return ! is_null($this->getValue()); |
|
152 | + return !is_null($this->getValue()); |
|
153 | 153 | } |
154 | 154 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | $dates = explode('::', $date); |
38 | 38 | |
39 | 39 | foreach ($dates as $i => $date) { |
40 | - $dates[$i] = parent::parserValue($date); |
|
40 | + $dates[ $i ] = parent::parserValue($date); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | return $dates; |