@@ -14,14 +14,14 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * @var array |
16 | 16 | */ |
17 | - protected $data = []; |
|
17 | + protected $data = [ ]; |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * @param string $view |
21 | 21 | * @param array $data |
22 | 22 | * @param Closure $callback |
23 | 23 | */ |
24 | - public function __construct($view, array $data = [], Closure $callback = null) |
|
24 | + public function __construct($view, array $data = [ ], Closure $callback = null) |
|
25 | 25 | { |
26 | 26 | $this->setView($view); |
27 | 27 | $this->setData($data); |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | { |
47 | 47 | $this->view = $view; |
48 | 48 | |
49 | - $this->setDisplay(function ($model) { |
|
50 | - $this->data['model'] = $model; |
|
49 | + $this->setDisplay(function($model) { |
|
50 | + $this->data[ 'model' ] = $model; |
|
51 | 51 | |
52 | 52 | return view($this->getView(), $this->data); |
53 | 53 | }); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | { |
28 | 28 | parent::initialize(); |
29 | 29 | |
30 | - $this->applyCallbackToItems(function ($item) { |
|
30 | + $this->applyCallbackToItems(function($item) { |
|
31 | 31 | if ($item instanceof Initializable) { |
32 | 32 | $item->initialize(); |
33 | 33 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | { |
66 | 66 | parent::setModel($model); |
67 | 67 | |
68 | - $this->applyCallbackToItems(function ($item) use ($model) { |
|
68 | + $this->applyCallbackToItems(function($item) use ($model) { |
|
69 | 69 | if ($item instanceof FormElementInterface) { |
70 | 70 | $item->setModel($model); |
71 | 71 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function getValidationMessages() |
113 | 113 | { |
114 | - $messages = []; |
|
114 | + $messages = [ ]; |
|
115 | 115 | |
116 | 116 | foreach ($this->getColumns() as $columnItems) { |
117 | 117 | foreach ($columnItems as $item) { |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function getValidationLabels() |
131 | 131 | { |
132 | - $labels = []; |
|
132 | + $labels = [ ]; |
|
133 | 133 | |
134 | 134 | foreach ($this->getColumns() as $columnItems) { |
135 | 135 | foreach ($columnItems as $item) { |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | { |
147 | 147 | parent::save(); |
148 | 148 | |
149 | - $this->applyCallbackToItems(function ($item) { |
|
149 | + $this->applyCallbackToItems(function($item) { |
|
150 | 150 | if ($item instanceof FormElementInterface) { |
151 | 151 | $item->save(); |
152 | 152 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | { |
158 | 158 | parent::afterSave(); |
159 | 159 | |
160 | - $this->applyCallbackToItems(function ($item) { |
|
160 | + $this->applyCallbackToItems(function($item) { |
|
161 | 161 | if ($item instanceof FormElementInterface) { |
162 | 162 | $item->afterSave(); |
163 | 163 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | ]; |
92 | 92 | |
93 | 93 | if ($this->isTaggable()) { |
94 | - $attributes['class'] .= ' input-taggable'; |
|
94 | + $attributes[ 'class' ] .= ' input-taggable'; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | return [ |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $attribute = $this->getAttribute(); |
117 | 117 | |
118 | 118 | if (is_null(Request::input($this->getPath()))) { |
119 | - $values = []; |
|
119 | + $values = [ ]; |
|
120 | 120 | } else { |
121 | 121 | $values = $this->getValue(); |
122 | 122 | } |
@@ -125,19 +125,19 @@ discard block |
||
125 | 125 | |
126 | 126 | if ($relation instanceof \Illuminate\Database\Eloquent\Relations\BelongsToMany) { |
127 | 127 | foreach ($values as $i => $value) { |
128 | - if (! array_key_exists($value, $this->getOptions()) and $this->isTaggable()) { |
|
128 | + if (!array_key_exists($value, $this->getOptions()) and $this->isTaggable()) { |
|
129 | 129 | $model = clone $this->getModelForOptions(); |
130 | 130 | $model->{$this->getDisplay()} = $value; |
131 | 131 | $model->save(); |
132 | 132 | |
133 | - $values[$i] = $model->getKey(); |
|
133 | + $values[ $i ] = $model->getKey(); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | 137 | $relation->sync($values); |
138 | 138 | } elseif ($relation instanceof \Illuminate\Database\Eloquent\Relations\HasMany) { |
139 | 139 | foreach ($relation->get() as $item) { |
140 | - if (! in_array($item->getKey(), $values)) { |
|
140 | + if (!in_array($item->getKey(), $values)) { |
|
141 | 141 | if ($this->isDeleteRelatedItem()) { |
142 | 142 | $item->delete(); |
143 | 143 | } else { |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $item = $model->find($value); |
154 | 154 | |
155 | 155 | if (is_null($item)) { |
156 | - if (! $this->isTaggable()) { |
|
156 | + if (!$this->isTaggable()) { |
|
157 | 157 | continue; |
158 | 158 | } |
159 | 159 |
@@ -9,8 +9,8 @@ |
||
9 | 9 | public function save() |
10 | 10 | { |
11 | 11 | $name = $this->getName(); |
12 | - if (! Request::has($name)) { |
|
13 | - Request::merge([$name => 0]); |
|
12 | + if (!Request::has($name)) { |
|
13 | + Request::merge([ $name => 0 ]); |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | parent::save(); |
@@ -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 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | /** |
20 | 20 | * @var array |
21 | 21 | */ |
22 | - protected $parameters = []; |
|
22 | + protected $parameters = [ ]; |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * @var bool |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function setHeight($height) |
90 | 90 | { |
91 | - $this->parameters['height'] = (int) $height; |
|
91 | + $this->parameters[ 'height' ] = (int) $height; |
|
92 | 92 | |
93 | 93 | return $this; |
94 | 94 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $filteredValue = $value; |
153 | 153 | } |
154 | 154 | |
155 | - if (! empty($this->filteredFieldKey)) { |
|
155 | + if (!empty($this->filteredFieldKey)) { |
|
156 | 156 | parent::setValue($model, $attribute, $value); |
157 | 157 | parent::setValue($model, $this->filteredFieldKey, $filteredValue); |
158 | 158 | } else { |
@@ -24,7 +24,7 @@ |
||
24 | 24 | */ |
25 | 25 | public function __construct(Closure $callback = null) |
26 | 26 | { |
27 | - if (! is_null($callback)) { |
|
27 | + if (!is_null($callback)) { |
|
28 | 28 | $this->setCallback($callback); |
29 | 29 | } |
30 | 30 |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $value = null; |
54 | 54 | } |
55 | 55 | |
56 | - if (! is_null($value)) { |
|
56 | + if (!is_null($value)) { |
|
57 | 57 | try { |
58 | 58 | $time = Carbon::parse($value); |
59 | 59 | } catch (Exception $e) { |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function setValue(Model $model, $attribute, $value) |
95 | 95 | { |
96 | - if (! is_null($value)) { |
|
96 | + if (!is_null($value)) { |
|
97 | 97 | $value = Carbon::createFromFormat($this->getFormat(), $value); |
98 | 98 | } |
99 | 99 |
@@ -14,13 +14,13 @@ |
||
14 | 14 | */ |
15 | 15 | protected static function validate(\Illuminate\Validation\Validator $validator) |
16 | 16 | { |
17 | - $validator->after(function ($validator) { |
|
17 | + $validator->after(function($validator) { |
|
18 | 18 | /** @var \Illuminate\Http\UploadedFile $file */ |
19 | 19 | $file = array_get($validator->attributes(), 'file'); |
20 | 20 | |
21 | 21 | $size = getimagesize($file->getRealPath()); |
22 | 22 | |
23 | - if (! $size) { |
|
23 | + if (!$size) { |
|
24 | 24 | $validator->errors()->add('file', trans('sleeping_owl::validation.not_image')); |
25 | 25 | } |
26 | 26 | }); |