@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | /** |
| 29 | 29 | * @var array |
| 30 | 30 | */ |
| 31 | - protected $validationRules = []; |
|
| 31 | + protected $validationRules = [ ]; |
|
| 32 | 32 | |
| 33 | 33 | public function __construct() |
| 34 | 34 | { |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function getValidationMessages() |
| 47 | 47 | { |
| 48 | - return []; |
|
| 48 | + return [ ]; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public function getValidationLabels() |
| 55 | 55 | { |
| 56 | - return []; |
|
| 56 | + return [ ]; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function addValidationRule($rule, $message = null) |
| 74 | 74 | { |
| 75 | - $this->validationRules[] = $rule; |
|
| 75 | + $this->validationRules[ ] = $rule; |
|
| 76 | 76 | |
| 77 | 77 | return $this; |
| 78 | 78 | } |
@@ -84,13 +84,13 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function setValidationRules($validationRules) |
| 86 | 86 | { |
| 87 | - if (! is_array($validationRules)) { |
|
| 87 | + if (!is_array($validationRules)) { |
|
| 88 | 88 | $validationRules = func_get_args(); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - $this->validationRules = []; |
|
| 91 | + $this->validationRules = [ ]; |
|
| 92 | 92 | foreach ($validationRules as $rule) { |
| 93 | - $this->validationRules[] = explode('|', $rule); |
|
| 93 | + $this->validationRules[ ] = explode('|', $rule); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | return $this; |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function setItems($items) |
| 42 | 42 | { |
| 43 | - if (! is_array($items)) { |
|
| 43 | + if (!is_array($items)) { |
|
| 44 | 44 | $items = func_get_args(); |
| 45 | 45 | } |
| 46 | 46 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | public function addHeader($items) |
| 70 | 70 | { |
| 71 | - if (! is_array($items)) { |
|
| 71 | + if (!is_array($items)) { |
|
| 72 | 72 | $items = func_get_args(); |
| 73 | 73 | } |
| 74 | 74 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function addBody($items) |
| 86 | 86 | { |
| 87 | - if (! is_array($items)) { |
|
| 87 | + if (!is_array($items)) { |
|
| 88 | 88 | $items = func_get_args(); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | public function addFooter($items) |
| 106 | 106 | { |
| 107 | - if (! is_array($items)) { |
|
| 107 | + if (!is_array($items)) { |
|
| 108 | 108 | $items = func_get_args(); |
| 109 | 109 | } |
| 110 | 110 | |
@@ -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 | parent::__construct(); |
| 27 | 27 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | parent::initialize(); |
| 34 | 34 | |
| 35 | - $this->getElements()->each(function ($element) { |
|
| 35 | + $this->getElements()->each(function($element) { |
|
| 36 | 36 | if ($element instanceof Initializable) { |
| 37 | 37 | $element->initialize(); |
| 38 | 38 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | { |
| 81 | 81 | parent::setModel($model); |
| 82 | 82 | |
| 83 | - $this->getElements()->each(function ($element) use ($model) { |
|
| 83 | + $this->getElements()->each(function($element) use ($model) { |
|
| 84 | 84 | if ($element instanceof FormElementInterface) { |
| 85 | 85 | $element->setModel($model); |
| 86 | 86 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | { |
| 97 | 97 | $rules = parent::getValidationRules(); |
| 98 | 98 | |
| 99 | - $this->getElements()->each(function ($element) use (&$rules) { |
|
| 99 | + $this->getElements()->each(function($element) use (&$rules) { |
|
| 100 | 100 | if ($element instanceof FormElementInterface) { |
| 101 | 101 | $rules += $element->getValidationRules(); |
| 102 | 102 | } |
@@ -110,9 +110,9 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | public function getValidationMessages() |
| 112 | 112 | { |
| 113 | - $messages = []; |
|
| 113 | + $messages = [ ]; |
|
| 114 | 114 | |
| 115 | - $this->getElements()->each(function ($element) use (&$messages) { |
|
| 115 | + $this->getElements()->each(function($element) use (&$messages) { |
|
| 116 | 116 | if ($element instanceof NamedFormElement) { |
| 117 | 117 | $messages += $element->getValidationMessages(); |
| 118 | 118 | } |
@@ -126,9 +126,9 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | public function getValidationLabels() |
| 128 | 128 | { |
| 129 | - $labels = []; |
|
| 129 | + $labels = [ ]; |
|
| 130 | 130 | |
| 131 | - $this->getElements()->each(function ($element) use (&$labels) { |
|
| 131 | + $this->getElements()->each(function($element) use (&$labels) { |
|
| 132 | 132 | if ($element instanceof NamedFormElement) { |
| 133 | 133 | $labels += $element->getValidationLabels(); |
| 134 | 134 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | { |
| 142 | 142 | parent::save(); |
| 143 | 143 | |
| 144 | - $this->getElements()->each(function ($element) use (&$labels) { |
|
| 144 | + $this->getElements()->each(function($element) use (&$labels) { |
|
| 145 | 145 | if ($element instanceof FormElementInterface) { |
| 146 | 146 | $element->save(); |
| 147 | 147 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | { |
| 153 | 153 | parent::afterSave(); |
| 154 | 154 | |
| 155 | - $this->getElements()->each(function ($element) use (&$labels) { |
|
| 155 | + $this->getElements()->each(function($element) use (&$labels) { |
|
| 156 | 156 | if ($element instanceof FormElementInterface) { |
| 157 | 157 | $element->afterSave(); |
| 158 | 158 | } |
@@ -89,14 +89,14 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $this->initialized = true; |
| 92 | - $this->repository = app(RepositoryInterface::class, [$this->class]); |
|
| 92 | + $this->repository = app(RepositoryInterface::class, [ $this->class ]); |
|
| 93 | 93 | |
| 94 | 94 | $this->setModel(app($this->class)); |
| 95 | 95 | |
| 96 | 96 | parent::initialize(); |
| 97 | 97 | |
| 98 | - $this->getElements()->each(function ($element) { |
|
| 99 | - if ($element instanceof Upload and ! $this->hasHtmlAttribute('enctype')) { |
|
| 98 | + $this->getElements()->each(function($element) { |
|
| 99 | + if ($element instanceof Upload and !$this->hasHtmlAttribute('enctype')) { |
|
| 100 | 100 | $this->setHtmlAttribute('enctype', 'multipart/form-data'); |
| 101 | 101 | } |
| 102 | 102 | }); |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | */ |
| 225 | 225 | public function setItems($items) |
| 226 | 226 | { |
| 227 | - if (! is_array($items)) { |
|
| 227 | + if (!is_array($items)) { |
|
| 228 | 228 | $items = func_get_args(); |
| 229 | 229 | } |
| 230 | 230 | |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | */ |
| 252 | 252 | public function setId($id) |
| 253 | 253 | { |
| 254 | - if (is_null($this->id) and ! is_null($id) and ($model = $this->getRepository()->find($id))) { |
|
| 254 | + if (is_null($this->id) and !is_null($id) and ($model = $this->getRepository()->find($id))) { |
|
| 255 | 255 | $this->id = $id; |
| 256 | 256 | $this->setModel($model); |
| 257 | 257 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @param array $columns |
| 30 | 30 | */ |
| 31 | - public function __construct(array $columns = []) |
|
| 31 | + public function __construct(array $columns = [ ]) |
|
| 32 | 32 | { |
| 33 | 33 | $this->setColumns($columns); |
| 34 | 34 | parent::__construct(); |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $column = new Column($column()); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - if (! ($column instanceof ColumnInterface)) { |
|
| 69 | + if (!($column instanceof ColumnInterface)) { |
|
| 70 | 70 | throw new \Exception('Column should be instance of ColumnInterface'); |
| 71 | 71 | } |
| 72 | 72 | |
@@ -79,16 +79,16 @@ discard block |
||
| 79 | 79 | { |
| 80 | 80 | $this->setHtmlAttribute('class', 'row'); |
| 81 | 81 | |
| 82 | - $count = $this->getColumns()->filter(function (ColumnInterface $column) { |
|
| 82 | + $count = $this->getColumns()->filter(function(ColumnInterface $column) { |
|
| 83 | 83 | return $column->getWidth() === 0; |
| 84 | 84 | })->count(); |
| 85 | 85 | |
| 86 | - $width = $this->maxWidth - $this->getColumns()->sum(function (ColumnInterface $column) { |
|
| 86 | + $width = $this->maxWidth - $this->getColumns()->sum(function(ColumnInterface $column) { |
|
| 87 | 87 | return $column->getWidth(); |
| 88 | 88 | }); |
| 89 | 89 | |
| 90 | - $this->getColumns()->each(function (ColumnInterface $column) use ($width,$count) { |
|
| 91 | - if (! $column->getWidth()) { |
|
| 90 | + $this->getColumns()->each(function(ColumnInterface $column) use ($width, $count) { |
|
| 91 | + if (!$column->getWidth()) { |
|
| 92 | 92 | $column->setWidth(floor($width / $count)); |
| 93 | 93 | } |
| 94 | 94 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | { |
| 106 | 106 | parent::setModel($model); |
| 107 | 107 | |
| 108 | - $this->getColumns()->each(function (ColumnInterface $column) use ($model) { |
|
| 108 | + $this->getColumns()->each(function(ColumnInterface $column) use ($model) { |
|
| 109 | 109 | $column->setModel($model); |
| 110 | 110 | }); |
| 111 | 111 | |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | { |
| 132 | 132 | $rules = parent::getValidationRules(); |
| 133 | 133 | |
| 134 | - $this->getColumns()->each(function (ColumnInterface $column) use (&$rules) { |
|
| 134 | + $this->getColumns()->each(function(ColumnInterface $column) use (&$rules) { |
|
| 135 | 135 | $rules += $column->getValidationRules(); |
| 136 | 136 | }); |
| 137 | 137 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | { |
| 146 | 146 | $messages = parent::getValidationMessages(); |
| 147 | 147 | |
| 148 | - $this->getColumns()->each(function (ColumnInterface $column) use (&$messages) { |
|
| 148 | + $this->getColumns()->each(function(ColumnInterface $column) use (&$messages) { |
|
| 149 | 149 | $messages += $column->getValidationMessages(); |
| 150 | 150 | }); |
| 151 | 151 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | { |
| 160 | 160 | $labels = parent::getValidationLabels(); |
| 161 | 161 | |
| 162 | - $this->getColumns()->each(function (ColumnInterface $column) use (&$labels) { |
|
| 162 | + $this->getColumns()->each(function(ColumnInterface $column) use (&$labels) { |
|
| 163 | 163 | $labels += $column->getValidationLabels(); |
| 164 | 164 | }); |
| 165 | 165 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | { |
| 171 | 171 | parent::save(); |
| 172 | 172 | |
| 173 | - $this->getColumns()->each(function (ColumnInterface $column) { |
|
| 173 | + $this->getColumns()->each(function(ColumnInterface $column) { |
|
| 174 | 174 | $column->save(); |
| 175 | 175 | }); |
| 176 | 176 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | { |
| 180 | 180 | parent::afterSave(); |
| 181 | 181 | |
| 182 | - $this->getColumns()->each(function (ColumnInterface $column) { |
|
| 182 | + $this->getColumns()->each(function(ColumnInterface $column) { |
|
| 183 | 183 | $column->afterSave(); |
| 184 | 184 | }); |
| 185 | 185 | } |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | */ |
| 206 | 206 | public function setSize($size) |
| 207 | 207 | { |
| 208 | - $this->getColumns()->each(function (ColumnInterface $column) use ($size) { |
|
| 208 | + $this->getColumns()->each(function(ColumnInterface $column) use ($size) { |
|
| 209 | 209 | $column->setSize($size); |
| 210 | 210 | }); |
| 211 | 211 | } |
@@ -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 | |
@@ -18,8 +18,8 @@ discard block |
||
| 18 | 18 | public static function registerRoutes() |
| 19 | 19 | { |
| 20 | 20 | $routeName = 'admin.form.element.file.'.static::$route; |
| 21 | - if (! Route::has($routeName)) { |
|
| 22 | - Route::post('FormElements/image/'.static::$route, ['as' => $routeName, function () { |
|
| 21 | + if (!Route::has($routeName)) { |
|
| 22 | + Route::post('FormElements/image/'.static::$route, [ 'as' => $routeName, function() { |
|
| 23 | 23 | $validator = Validator::make(Request::all(), static::uploadValidationRules()); |
| 24 | 24 | |
| 25 | 25 | static::uploadValidationRules($validator); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | 'url' => asset($value), |
| 41 | 41 | 'value' => $value, |
| 42 | 42 | ]; |
| 43 | - }]); |
|
| 43 | + } ]); |
|
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | |