@@ -91,11 +91,11 @@ discard block |
||
| 91 | 91 | ]; |
| 92 | 92 | |
| 93 | 93 | if ($this->isReadonly()) { |
| 94 | - $attributes['disabled'] = 'disabled'; |
|
| 94 | + $attributes[ 'disabled' ] = 'disabled'; |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | if ($this->isTaggable()) { |
| 98 | - $attributes['class'] .= ' input-taggable'; |
|
| 98 | + $attributes[ 'class' ] .= ' input-taggable'; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | return [ |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $attribute = $this->getAttribute(); |
| 121 | 121 | |
| 122 | 122 | if (is_null(Request::input($this->getPath()))) { |
| 123 | - $values = []; |
|
| 123 | + $values = [ ]; |
|
| 124 | 124 | } else { |
| 125 | 125 | $values = $this->getValue(); |
| 126 | 126 | } |
@@ -129,19 +129,19 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | if ($relation instanceof \Illuminate\Database\Eloquent\Relations\BelongsToMany) { |
| 131 | 131 | foreach ($values as $i => $value) { |
| 132 | - if (! array_key_exists($value, $this->getOptions()) and $this->isTaggable()) { |
|
| 132 | + if (!array_key_exists($value, $this->getOptions()) and $this->isTaggable()) { |
|
| 133 | 133 | $model = clone $this->getModelForOptions(); |
| 134 | 134 | $model->{$this->getDisplay()} = $value; |
| 135 | 135 | $model->save(); |
| 136 | 136 | |
| 137 | - $values[$i] = $model->getKey(); |
|
| 137 | + $values[ $i ] = $model->getKey(); |
|
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | $relation->sync($values); |
| 142 | 142 | } elseif ($relation instanceof \Illuminate\Database\Eloquent\Relations\HasMany) { |
| 143 | 143 | foreach ($relation->get() as $item) { |
| 144 | - if (! in_array($item->getKey(), $values)) { |
|
| 144 | + if (!in_array($item->getKey(), $values)) { |
|
| 145 | 145 | if ($this->isDeleteRelatedItem()) { |
| 146 | 146 | $item->delete(); |
| 147 | 147 | } else { |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | $item = $model->find($value); |
| 158 | 158 | |
| 159 | 159 | if (is_null($item)) { |
| 160 | - if (! $this->isTaggable()) { |
|
| 160 | + if (!$this->isTaggable()) { |
|
| 161 | 161 | continue; |
| 162 | 162 | } |
| 163 | 163 | |
@@ -17,13 +17,13 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | protected static function validate(Validator $validator) |
| 19 | 19 | { |
| 20 | - $validator->after(function ($validator) { |
|
| 20 | + $validator->after(function($validator) { |
|
| 21 | 21 | /** @var \Illuminate\Http\UploadedFile $file */ |
| 22 | 22 | $file = array_get($validator->attributes(), 'file'); |
| 23 | 23 | |
| 24 | 24 | $size = getimagesize($file->getRealPath()); |
| 25 | 25 | |
| 26 | - if (! $size) { |
|
| 26 | + if (!$size) { |
|
| 27 | 27 | $validator->errors()->add('file', trans('sleeping_owl::validation.not_image')); |
| 28 | 28 | } |
| 29 | 29 | }); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $image = \Intervention\Image\Facades\Image::make($file); |
| 46 | 46 | |
| 47 | 47 | foreach ($settings as $method => $args) { |
| 48 | - call_user_func_array([$image, $method], $args); |
|
| 48 | + call_user_func_array([ $image, $method ], $args); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | return $image->save($path.'/'.$filename); |
@@ -77,5 +77,5 @@ discard block |
||
| 77 | 77 | /** |
| 78 | 78 | * @var array |
| 79 | 79 | */ |
| 80 | - protected $uploadValidationRules = ['required', 'image']; |
|
| 80 | + protected $uploadValidationRules = [ 'required', 'image' ]; |
|
| 81 | 81 | } |
@@ -313,11 +313,11 @@ discard block |
||
| 313 | 313 | */ |
| 314 | 314 | public function isShowDeleteButton() |
| 315 | 315 | { |
| 316 | - if (is_null($this->getModel()->getKey()) || ! $this->showDeleteButton) { |
|
| 316 | + if (is_null($this->getModel()->getKey()) || !$this->showDeleteButton) { |
|
| 317 | 317 | return false; |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - $this->showDeleteButton = ! $this->isTrashed() && $this->getModelConfiguration()->isDeletable($this->getModel()); |
|
| 320 | + $this->showDeleteButton = !$this->isTrashed() && $this->getModelConfiguration()->isDeletable($this->getModel()); |
|
| 321 | 321 | |
| 322 | 322 | return $this->showDeleteButton; |
| 323 | 323 | } |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | */ |
| 338 | 338 | public function isShowDestroyButton() |
| 339 | 339 | { |
| 340 | - if (is_null($this->getModel()->getKey()) || ! $this->showDestroyButton) { |
|
| 340 | + if (is_null($this->getModel()->getKey()) || !$this->showDestroyButton) { |
|
| 341 | 341 | return false; |
| 342 | 342 | } |
| 343 | 343 | |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | */ |
| 363 | 363 | public function isShowRestoreButton() |
| 364 | 364 | { |
| 365 | - if (is_null($this->getModel()->getKey()) || ! $this->showRestoreButton) { |
|
| 365 | + if (is_null($this->getModel()->getKey()) || !$this->showRestoreButton) { |
|
| 366 | 366 | return false; |
| 367 | 367 | } |
| 368 | 368 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * |
| 74 | 74 | * @param array $elements |
| 75 | 75 | */ |
| 76 | - public function __construct(array $elements = []) |
|
| 76 | + public function __construct(array $elements = [ ]) |
|
| 77 | 77 | { |
| 78 | 78 | parent::__construct($elements); |
| 79 | 79 | |
@@ -94,14 +94,14 @@ discard block |
||
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | $this->initialized = true; |
| 97 | - $this->repository = app(RepositoryInterface::class, [$this->class]); |
|
| 97 | + $this->repository = app(RepositoryInterface::class, [ $this->class ]); |
|
| 98 | 98 | |
| 99 | 99 | $this->setModel(app($this->class)); |
| 100 | 100 | |
| 101 | 101 | parent::initialize(); |
| 102 | 102 | |
| 103 | - $this->getElements()->each(function ($element) { |
|
| 104 | - if ($element instanceof Upload and ! $this->hasHtmlAttribute('enctype')) { |
|
| 103 | + $this->getElements()->each(function($element) { |
|
| 104 | + if ($element instanceof Upload and !$this->hasHtmlAttribute('enctype')) { |
|
| 105 | 105 | $this->setHtmlAttribute('enctype', 'multipart/form-data'); |
| 106 | 106 | } |
| 107 | 107 | }); |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | */ |
| 231 | 231 | public function setItems($items) |
| 232 | 232 | { |
| 233 | - if (! is_array($items)) { |
|
| 233 | + if (!is_array($items)) { |
|
| 234 | 234 | $items = func_get_args(); |
| 235 | 235 | } |
| 236 | 236 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | public function setId($id) |
| 259 | 259 | { |
| 260 | - if (is_null($this->id) and ! is_null($id) and ($model = $this->getRepository()->find($id))) { |
|
| 260 | + if (is_null($this->id) and !is_null($id) and ($model = $this->getRepository()->find($id))) { |
|
| 261 | 261 | $this->id = $id; |
| 262 | 262 | $this->setModel($model); |
| 263 | 263 | } |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | $model = $this->getModel(); |
| 324 | 324 | |
| 325 | 325 | foreach ($model->getRelations() as $name => $relation) { |
| 326 | - if ($model->{$name}() instanceof BelongsTo && ! is_null($relation)) { |
|
| 326 | + if ($model->{$name}() instanceof BelongsTo && !is_null($relation)) { |
|
| 327 | 327 | $relation->save(); |
| 328 | 328 | $model->{$name}()->associate($relation); |
| 329 | 329 | } |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | $model = $this->getModel(); |
| 336 | 336 | |
| 337 | 337 | foreach ($model->getRelations() as $name => $relation) { |
| 338 | - if ($model->{$name}() instanceof HasOneOrMany && ! is_null($relation)) { |
|
| 338 | + if ($model->{$name}() instanceof HasOneOrMany && !is_null($relation)) { |
|
| 339 | 339 | if (is_array($relation) || $relation instanceof \Traversable) { |
| 340 | 340 | $model->{$name}()->saveMany($relation); |
| 341 | 341 | } else { |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @param array $elements |
| 23 | 23 | */ |
| 24 | - public function __construct(array $elements = []) |
|
| 24 | + public function __construct(array $elements = [ ]) |
|
| 25 | 25 | { |
| 26 | 26 | $this->elements = new Collection(); |
| 27 | 27 | parent::__construct($elements); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $element = new Column($element); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - if (! ($element instanceof ColumnInterface)) { |
|
| 70 | + if (!($element instanceof ColumnInterface)) { |
|
| 71 | 71 | throw new \Exception('Column should be instance of ColumnInterface'); |
| 72 | 72 | } |
| 73 | 73 | |
@@ -82,16 +82,16 @@ discard block |
||
| 82 | 82 | { |
| 83 | 83 | $this->setHtmlAttribute('class', 'row'); |
| 84 | 84 | |
| 85 | - $count = $this->getElements()->filter(function (ColumnInterface $column) { |
|
| 85 | + $count = $this->getElements()->filter(function(ColumnInterface $column) { |
|
| 86 | 86 | return $column->getWidth() === 0; |
| 87 | 87 | })->count(); |
| 88 | 88 | |
| 89 | - $width = $this->maxWidth - $this->getElements()->sum(function (ColumnInterface $column) { |
|
| 89 | + $width = $this->maxWidth - $this->getElements()->sum(function(ColumnInterface $column) { |
|
| 90 | 90 | return $column->getWidth(); |
| 91 | 91 | }); |
| 92 | 92 | |
| 93 | - $this->getElements()->each(function (ColumnInterface $column) use ($width, $count) { |
|
| 94 | - if (! $column->getWidth()) { |
|
| 93 | + $this->getElements()->each(function(ColumnInterface $column) use ($width, $count) { |
|
| 94 | + if (!$column->getWidth()) { |
|
| 95 | 95 | $column->setWidth(floor($width / $count)); |
| 96 | 96 | } |
| 97 | 97 | }); |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | public function setSize($size) |
| 133 | 133 | { |
| 134 | - $this->getColumns()->each(function (ColumnInterface $column) use ($size) { |
|
| 134 | + $this->getColumns()->each(function(ColumnInterface $column) use ($size) { |
|
| 135 | 135 | $column->setSize($size); |
| 136 | 136 | }); |
| 137 | 137 | } |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | * |
| 15 | 15 | * @param array $elements |
| 16 | 16 | */ |
| 17 | - public function __construct(array $elements = []) |
|
| 17 | + public function __construct(array $elements = [ ]) |
|
| 18 | 18 | { |
| 19 | 19 | parent::__construct(); |
| 20 | 20 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | public function initializeElements() |
| 20 | 20 | { |
| 21 | - $this->getElements()->each(function ($element) { |
|
| 21 | + $this->getElements()->each(function($element) { |
|
| 22 | 22 | if ($element instanceof Initializable) { |
| 23 | 23 | $element->initialize(); |
| 24 | 24 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | foreach ($this->getElements() as $element) { |
| 38 | 38 | if ($element instanceof ElementsInterface) { |
| 39 | - if (! is_null($found = $element->getElement($path))) { |
|
| 39 | + if (!is_null($found = $element->getElement($path))) { |
|
| 40 | 40 | return $found; |
| 41 | 41 | } |
| 42 | 42 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | protected function setModelForElements(Model $model) |
| 132 | 132 | { |
| 133 | - $this->getElements()->each(function ($element) use ($model) { |
|
| 133 | + $this->getElements()->each(function($element) use ($model) { |
|
| 134 | 134 | $element = $this->getElementContainer($element); |
| 135 | 135 | if ($element instanceof FormElementInterface) { |
| 136 | 136 | $element->setModel($model); |
@@ -145,9 +145,9 @@ discard block |
||
| 145 | 145 | * |
| 146 | 146 | * @return array |
| 147 | 147 | */ |
| 148 | - protected function getValidationRulesFromElements(array $rules = []) |
|
| 148 | + protected function getValidationRulesFromElements(array $rules = [ ]) |
|
| 149 | 149 | { |
| 150 | - $this->getElements()->each(function ($element) use (&$rules) { |
|
| 150 | + $this->getElements()->each(function($element) use (&$rules) { |
|
| 151 | 151 | $element = $this->getElementContainer($element); |
| 152 | 152 | if ($element instanceof FormElementInterface) { |
| 153 | 153 | $rules += $element->getValidationRules(); |
@@ -162,9 +162,9 @@ discard block |
||
| 162 | 162 | * |
| 163 | 163 | * @return array |
| 164 | 164 | */ |
| 165 | - protected function getValidationMessagesForElements(array $messages = []) |
|
| 165 | + protected function getValidationMessagesForElements(array $messages = [ ]) |
|
| 166 | 166 | { |
| 167 | - $this->getElements()->each(function ($element) use (&$messages) { |
|
| 167 | + $this->getElements()->each(function($element) use (&$messages) { |
|
| 168 | 168 | $element = $this->getElementContainer($element); |
| 169 | 169 | if ($element instanceof NamedFormElement) { |
| 170 | 170 | $messages += $element->getValidationMessages(); |
@@ -179,9 +179,9 @@ discard block |
||
| 179 | 179 | * |
| 180 | 180 | * @return array |
| 181 | 181 | */ |
| 182 | - protected function getValidationLabelsForElements(array $labels = []) |
|
| 182 | + protected function getValidationLabelsForElements(array $labels = [ ]) |
|
| 183 | 183 | { |
| 184 | - $this->getElements()->each(function ($element) use (&$labels) { |
|
| 184 | + $this->getElements()->each(function($element) use (&$labels) { |
|
| 185 | 185 | $element = $this->getElementContainer($element); |
| 186 | 186 | if ($element instanceof NamedFormElement) { |
| 187 | 187 | $labels += $element->getValidationLabels(); |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | protected function saveElements() |
| 195 | 195 | { |
| 196 | - $this->getElements()->each(function ($element) { |
|
| 196 | + $this->getElements()->each(function($element) { |
|
| 197 | 197 | $element = $this->getElementContainer($element); |
| 198 | 198 | if ($element instanceof FormElementInterface) { |
| 199 | 199 | $element->save(); |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | protected function afterSaveElements() |
| 205 | 205 | { |
| 206 | - $this->getElements()->each(function ($element) { |
|
| 206 | + $this->getElements()->each(function($element) { |
|
| 207 | 207 | $element = $this->getElementContainer($element); |
| 208 | 208 | if ($element instanceof FormElementInterface) { |
| 209 | 209 | $element->afterSave(); |
@@ -87,6 +87,6 @@ |
||
| 87 | 87 | | |
| 88 | 88 | */ |
| 89 | 89 | |
| 90 | - 'attributes' => [], |
|
| 90 | + 'attributes' => [ ], |
|
| 91 | 91 | |
| 92 | 92 | ]; |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (! function_exists('resources_url')) { |
|
| 3 | +if (!function_exists('resources_url')) { |
|
| 4 | 4 | function resources_url($path) |
| 5 | 5 | { |
| 6 | 6 | return '/packages/sleepingowl/default/'.$path; |
@@ -14,11 +14,11 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | 16 | WysiwygManager::register('ckeditor') |
| 17 | - ->js(null, '//cdn.ckeditor.com/4.5.7/standard/ckeditor.js', ['jquery']); |
|
| 17 | + ->js(null, '//cdn.ckeditor.com/4.5.7/standard/ckeditor.js', [ 'jquery' ]); |
|
| 18 | 18 | |
| 19 | 19 | WysiwygManager::register('tinymce') |
| 20 | - ->js(null, '//cdn.tinymce.com/4/tinymce.min.js', ['jquery']); |
|
| 20 | + ->js(null, '//cdn.tinymce.com/4/tinymce.min.js', [ 'jquery' ]); |
|
| 21 | 21 | |
| 22 | 22 | WysiwygManager::register('simplemde', new \SleepingOwl\Admin\Wysiwyg\MarkdownFilter()) |
| 23 | - ->js(null, '//cdn.jsdelivr.net/simplemde/latest/simplemde.min.js', ['jquery']) |
|
| 23 | + ->js(null, '//cdn.jsdelivr.net/simplemde/latest/simplemde.min.js', [ 'jquery' ]) |
|
| 24 | 24 | ->css(null, '//cdn.jsdelivr.net/simplemde/latest/simplemde.min.css'); |