@@ -288,7 +288,7 @@ |
||
| 288 | 288 | return ''; |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | - return $tools->map(function ($tool) { |
|
| 291 | + return $tools->map(function($tool) { |
|
| 292 | 292 | if ($tool instanceof Renderable) { |
| 293 | 293 | return $tool->render(); |
| 294 | 294 | } |
@@ -275,7 +275,7 @@ |
||
| 275 | 275 | */ |
| 276 | 276 | protected function renderCustomTools($tools) |
| 277 | 277 | { |
| 278 | - return $tools->map(function ($tool) { |
|
| 278 | + return $tools->map(function($tool) { |
|
| 279 | 279 | if ($tool instanceof Renderable) { |
| 280 | 280 | return $tool->render(); |
| 281 | 281 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | public function using(array $values, $default = null) |
| 152 | 152 | { |
| 153 | - return $this->as(function ($value) use ($values, $default) { |
|
| 153 | + return $this->as(function($value) use ($values, $default) { |
|
| 154 | 154 | if (is_null($value)) { |
| 155 | 155 | return $default; |
| 156 | 156 | } |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | public function image($server = '', $width = 200, $height = 200) |
| 172 | 172 | { |
| 173 | - return $this->as(function ($path) use ($server, $width, $height) { |
|
| 173 | + return $this->as(function($path) use ($server, $width, $height) { |
|
| 174 | 174 | if (url()->isValidUrl($path)) { |
| 175 | 175 | $src = $path; |
| 176 | 176 | } elseif ($server) { |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | */ |
| 194 | 194 | public function link($href = '', $target = '_blank') |
| 195 | 195 | { |
| 196 | - return $this->as(function ($link) use ($href, $target) { |
|
| 196 | + return $this->as(function($link) use ($href, $target) { |
|
| 197 | 197 | $href = $href ?: $link; |
| 198 | 198 | |
| 199 | 199 | return "<a href='$href' target='{$target}'>{$link}</a>"; |
@@ -209,12 +209,12 @@ discard block |
||
| 209 | 209 | */ |
| 210 | 210 | public function label($style = 'success') |
| 211 | 211 | { |
| 212 | - return $this->as(function ($value) use ($style) { |
|
| 212 | + return $this->as(function($value) use ($style) { |
|
| 213 | 213 | if ($value instanceof Arrayable) { |
| 214 | 214 | $value = $value->toArray(); |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | - return collect((array) $value)->map(function ($name) use ($style) { |
|
| 217 | + return collect((array) $value)->map(function($name) use ($style) { |
|
| 218 | 218 | return "<span class='label label-{$style}'>$name</span>"; |
| 219 | 219 | })->implode(' '); |
| 220 | 220 | }); |
@@ -229,12 +229,12 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | public function badge($style = 'blue') |
| 231 | 231 | { |
| 232 | - return $this->as(function ($value) use ($style) { |
|
| 232 | + return $this->as(function($value) use ($style) { |
|
| 233 | 233 | if ($value instanceof Arrayable) { |
| 234 | 234 | $value = $value->toArray(); |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | - return collect((array) $value)->map(function ($name) use ($style) { |
|
| 237 | + return collect((array) $value)->map(function($name) use ($style) { |
|
| 238 | 238 | return "<span class='badge bg-{$style}'>$name</span>"; |
| 239 | 239 | })->implode(' '); |
| 240 | 240 | }); |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | { |
| 250 | 250 | $field = $this; |
| 251 | 251 | |
| 252 | - return $this->as(function ($value) use ($field) { |
|
| 252 | + return $this->as(function($value) use ($field) { |
|
| 253 | 253 | |
| 254 | 254 | $content = json_decode($value, true); |
| 255 | 255 | |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | public function render() |
| 339 | 339 | { |
| 340 | 340 | if ($this->showAs->isNotEmpty()) { |
| 341 | - $this->showAs->each(function ($callable) { |
|
| 341 | + $this->showAs->each(function($callable) { |
|
| 342 | 342 | $this->value = $callable->call( |
| 343 | 343 | $this->parent->getModel(), |
| 344 | 344 | $this->value |
@@ -306,9 +306,9 @@ discard block |
||
| 306 | 306 | $data = $this->model->with($this->getRelations()) |
| 307 | 307 | ->findOrFail($id)->toArray(); |
| 308 | 308 | |
| 309 | - $this->builder->fields()->filter(function ($field) { |
|
| 309 | + $this->builder->fields()->filter(function($field) { |
|
| 310 | 310 | return $field instanceof Field\File; |
| 311 | - })->each(function (File $file) use ($data) { |
|
| 311 | + })->each(function(File $file) use ($data) { |
|
| 312 | 312 | $file->setOriginal($data); |
| 313 | 313 | |
| 314 | 314 | $file->destroy(); |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | return $response; |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - DB::transaction(function () { |
|
| 336 | + DB::transaction(function() { |
|
| 337 | 337 | $inserts = $this->prepareInsert($this->updates); |
| 338 | 338 | |
| 339 | 339 | foreach ($inserts as $column => $value) { |
@@ -520,7 +520,7 @@ discard block |
||
| 520 | 520 | return $response; |
| 521 | 521 | } |
| 522 | 522 | |
| 523 | - DB::transaction(function () { |
|
| 523 | + DB::transaction(function() { |
|
| 524 | 524 | $updates = $this->prepareUpdate($this->updates); |
| 525 | 525 | |
| 526 | 526 | foreach ($updates as $column => $value) { |
@@ -582,10 +582,10 @@ discard block |
||
| 582 | 582 | { |
| 583 | 583 | if (request('after-save') == 1) { |
| 584 | 584 | // continue editing |
| 585 | - $url = rtrim($resourcesPath, '/') . "/{$key}/edit"; |
|
| 585 | + $url = rtrim($resourcesPath, '/')."/{$key}/edit"; |
|
| 586 | 586 | } elseif (request('after-save') == 2) { |
| 587 | 587 | // view resource |
| 588 | - $url = rtrim($resourcesPath, '/') . "/{$key}"; |
|
| 588 | + $url = rtrim($resourcesPath, '/')."/{$key}"; |
|
| 589 | 589 | } else { |
| 590 | 590 | $url = request(Builder::PREVIOUS_URL_KEY) ?: $resourcesPath; |
| 591 | 591 | } |
@@ -949,7 +949,7 @@ discard block |
||
| 949 | 949 | protected function getFieldByColumn($column) |
| 950 | 950 | { |
| 951 | 951 | return $this->builder->fields()->first( |
| 952 | - function (Field $field) use ($column) { |
|
| 952 | + function(Field $field) use ($column) { |
|
| 953 | 953 | if (is_array($field->column())) { |
| 954 | 954 | return in_array($column, $field->column()); |
| 955 | 955 | } |
@@ -970,7 +970,7 @@ discard block |
||
| 970 | 970 | |
| 971 | 971 | $values = $this->model->toArray(); |
| 972 | 972 | |
| 973 | - $this->builder->fields()->each(function (Field $field) use ($values) { |
|
| 973 | + $this->builder->fields()->each(function(Field $field) use ($values) { |
|
| 974 | 974 | $field->setOriginal($values); |
| 975 | 975 | }); |
| 976 | 976 | } |
@@ -992,7 +992,7 @@ discard block |
||
| 992 | 992 | |
| 993 | 993 | $data = $this->model->toArray(); |
| 994 | 994 | |
| 995 | - $this->builder->fields()->each(function (Field $field) use ($data) { |
|
| 995 | + $this->builder->fields()->each(function(Field $field) use ($data) { |
|
| 996 | 996 | if (!in_array($field->column(), $this->ignored)) { |
| 997 | 997 | $field->fill($data); |
| 998 | 998 | } |
@@ -1113,7 +1113,7 @@ discard block |
||
| 1113 | 1113 | */ |
| 1114 | 1114 | public function setWidth($fieldWidth = 8, $labelWidth = 2) |
| 1115 | 1115 | { |
| 1116 | - $this->builder()->fields()->each(function ($field) use ($fieldWidth, $labelWidth) { |
|
| 1116 | + $this->builder()->fields()->each(function($field) use ($fieldWidth, $labelWidth) { |
|
| 1117 | 1117 | /* @var Field $field */ |
| 1118 | 1118 | $field->setWidth($fieldWidth, $labelWidth); |
| 1119 | 1119 | }); |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | { |
| 208 | 208 | $inputs = array_dot(Input::all()); |
| 209 | 209 | |
| 210 | - $inputs = array_filter($inputs, function ($input) { |
|
| 210 | + $inputs = array_filter($inputs, function($input) { |
|
| 211 | 211 | return $input !== '' && !is_null($input); |
| 212 | 212 | }); |
| 213 | 213 | |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | $conditions[] = $filter->condition($params); |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - return tap(array_filter($conditions), function ($conditions) { |
|
| 234 | + return tap(array_filter($conditions), function($conditions) { |
|
| 235 | 235 | if (!empty($conditions)) { |
| 236 | 236 | $this->expand(); |
| 237 | 237 | } |
@@ -249,9 +249,9 @@ discard block |
||
| 249 | 249 | return $inputs; |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | - $inputs = collect($inputs)->filter(function ($input, $key) { |
|
| 252 | + $inputs = collect($inputs)->filter(function($input, $key) { |
|
| 253 | 253 | return starts_with($key, "{$this->name}_"); |
| 254 | - })->mapWithKeys(function ($val, $key) { |
|
| 254 | + })->mapWithKeys(function($val, $key) { |
|
| 255 | 255 | $key = str_replace("{$this->name}_", '', $key); |
| 256 | 256 | |
| 257 | 257 | return [$key => $val]; |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | */ |
| 302 | 302 | public function scope($key, $label = '') |
| 303 | 303 | { |
| 304 | - return tap(new Scope($key, $label), function (Scope $scope) { |
|
| 304 | + return tap(new Scope($key, $label), function(Scope $scope) { |
|
| 305 | 305 | return $this->scopes->push($scope); |
| 306 | 306 | }); |
| 307 | 307 | } |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | { |
| 326 | 326 | $key = request(Scope::QUERY_NAME); |
| 327 | 327 | |
| 328 | - return $this->scopes->first(function ($scope) use ($key) { |
|
| 328 | + return $this->scopes->first(function($scope) use ($key) { |
|
| 329 | 329 | return $scope->key == $key; |
| 330 | 330 | }); |
| 331 | 331 | } |