We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -3,7 +3,7 @@ |
||
3 | 3 | <?php |
4 | 4 | // if the column has been cast to Carbon or Date (using attribute casting) |
5 | 5 | // get the value as a date string |
6 | -if (isset($field['value']) && ( $field['value'] instanceof \Carbon\Carbon || $field['value'] instanceof \Jenssegers\Date\Date )) { |
|
6 | +if (isset($field['value']) && ($field['value'] instanceof \Carbon\Carbon || $field['value'] instanceof \Jenssegers\Date\Date)) { |
|
7 | 7 | $field['value'] = $field['value']->toDateTimeString(); |
8 | 8 | } |
9 | 9 | ?> |
@@ -3,11 +3,11 @@ |
||
3 | 3 | <?php |
4 | 4 | // if the column has been cast to Carbon or Date (using attribute casting) |
5 | 5 | // get the value as a date string |
6 | - if (isset($field['value']) && ( $field['value'] instanceof \Carbon\Carbon || $field['value'] instanceof \Jenssegers\Date\Date )) { |
|
6 | + if (isset($field['value']) && ($field['value'] instanceof \Carbon\Carbon || $field['value'] instanceof \Jenssegers\Date\Date)) { |
|
7 | 7 | $field['value'] = $field['value']->format('Y-m-d'); |
8 | 8 | } |
9 | 9 | |
10 | - $field_language = isset($field['date_picker_options']['language'])?$field['date_picker_options']['language']:\App::getLocale(); |
|
10 | + $field_language = isset($field['date_picker_options']['language']) ? $field['date_picker_options']['language'] : \App::getLocale(); |
|
11 | 11 | ?> |
12 | 12 | |
13 | 13 | <div @include('crud::inc.field_wrapper_attributes') > |
@@ -5,7 +5,7 @@ |
||
5 | 5 | $min = isset($field['min']) && (int) $field['min'] > 0 ? $field['min'] : -1; |
6 | 6 | $item_name = strtolower(isset($field['entity_singular']) && !empty($field['entity_singular']) ? $field['entity_singular'] : $field['label']); |
7 | 7 | |
8 | - $items = old($field['name']) ? (old($field['name'])) : (isset($field['value']) ? ($field['value']) : (isset($field['default']) ? ($field['default']) : '' )); |
|
8 | + $items = old($field['name']) ? (old($field['name'])) : (isset($field['value']) ? ($field['value']) : (isset($field['default']) ? ($field['default']) : '')); |
|
9 | 9 | |
10 | 10 | // make sure not matter the attribute casting |
11 | 11 | // the $items variable contains a properly defined JSON |
@@ -76,10 +76,10 @@ |
||
76 | 76 | <ol class="sortable"> |
77 | 77 | <?php |
78 | 78 | $all_entries = collect($entries->all())->sortBy('lft')->keyBy($crud->getModel()->getKeyName()); |
79 | - $root_entries = $all_entries->filter(function ($item) { |
|
79 | + $root_entries = $all_entries->filter(function($item) { |
|
80 | 80 | return $item->parent_id == 0; |
81 | 81 | }); |
82 | - foreach ($root_entries as $key => $entry){ |
|
82 | + foreach ($root_entries as $key => $entry) { |
|
83 | 83 | $root_entries[$key] = tree_element($entry, $key, $all_entries, $crud); |
84 | 84 | } |
85 | 85 | ?> |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Backpack\CRUD\ModelTraits\SpatieTranslatable; |
4 | 4 | |
5 | -use Illuminate\Database\Eloquent\Model; |
|
6 | 5 | use Illuminate\Contracts\Events\Dispatcher; |
6 | +use Illuminate\Database\Eloquent\Model; |
|
7 | 7 | |
8 | 8 | class SluggableObserver extends \Cviebrock\EloquentSluggable\SluggableObserver |
9 | 9 | { |
@@ -47,7 +47,7 @@ |
||
47 | 47 | $separator = $config['separator']; |
48 | 48 | $attribute = $attribute.'->'.$this->getLocale(); |
49 | 49 | |
50 | - return $query->where(function (Builder $q) use ($attribute, $slug, $separator) { |
|
50 | + return $query->where(function(Builder $q) use ($attribute, $slug, $separator) { |
|
51 | 51 | $q->where($attribute, '=', $slug) |
52 | 52 | ->orWhere($attribute, 'LIKE', $slug.$separator.'%'); |
53 | 53 | }); |
@@ -2,9 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace Backpack\CRUD\ModelTraits\SpatieTranslatable; |
4 | 4 | |
5 | -use Illuminate\Database\Eloquent\Model; |
|
6 | -use Illuminate\Database\Eloquent\Builder; |
|
7 | 5 | use Cviebrock\EloquentSluggable\Sluggable as OriginalSluggable; |
6 | +use Illuminate\Database\Eloquent\Builder; |
|
7 | +use Illuminate\Database\Eloquent\Model; |
|
8 | 8 | |
9 | 9 | trait Sluggable |
10 | 10 | { |
@@ -37,7 +37,6 @@ |
||
37 | 37 | * Query scope for finding "similar" slugs, used to determine uniqueness. |
38 | 38 | * |
39 | 39 | * @param \Illuminate\Database\Eloquent\Builder $query |
40 | - * @param \Illuminate\Database\Eloquent\Model $model |
|
41 | 40 | * @param string $attribute |
42 | 41 | * @param array $config |
43 | 42 | * @param string $slug |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function getAttributeValue($key) |
26 | 26 | { |
27 | - if (! $this->isTranslatableAttribute($key)) { |
|
27 | + if (!$this->isTranslatableAttribute($key)) { |
|
28 | 28 | return parent::getAttributeValue($key); |
29 | 29 | } |
30 | 30 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function update(array $attributes = [], array $options = []) |
74 | 74 | { |
75 | - if (! $this->exists) { |
|
75 | + if (!$this->exists) { |
|
76 | 76 | return false; |
77 | 77 | } |
78 | 78 |
@@ -3,19 +3,17 @@ |
||
3 | 3 | namespace Backpack\CRUD\app\Http\Controllers; |
4 | 4 | |
5 | 5 | use Backpack\CRUD\CrudPanel; |
6 | -use Illuminate\Http\Request; |
|
7 | -use Illuminate\Support\Facades\Form as Form; |
|
6 | +use Backpack\CRUD\app\Http\Controllers\CrudFeatures\AjaxTable; |
|
7 | +use Backpack\CRUD\app\Http\Controllers\CrudFeatures\Reorder; |
|
8 | 8 | use Illuminate\Foundation\Bus\DispatchesJobs; |
9 | -use Illuminate\Routing\Controller as BaseController; |
|
10 | 9 | use Illuminate\Foundation\Validation\ValidatesRequests; |
11 | -use Backpack\CRUD\app\Http\Controllers\CrudFeatures\Reorder; |
|
12 | -use Backpack\CRUD\app\Http\Controllers\CrudFeatures\AjaxTable; |
|
10 | +use Illuminate\Http\Request; |
|
11 | +use Illuminate\Routing\Controller as BaseController; |
|
13 | 12 | // CRUD Traits for non-core features |
14 | 13 | use Backpack\CRUD\app\Http\Controllers\CrudFeatures\Revisions; |
15 | 14 | use Backpack\CRUD\app\Http\Controllers\CrudFeatures\SaveActions; |
16 | -use Backpack\CRUD\app\Http\Requests\CrudRequest as StoreRequest; |
|
17 | -use Backpack\CRUD\app\Http\Requests\CrudRequest as UpdateRequest; |
|
18 | 15 | use Backpack\CRUD\app\Http\Controllers\CrudFeatures\ShowDetailsRow; |
16 | +use Backpack\CRUD\app\Http\Requests\CrudRequest as UpdateRequest; |
|
19 | 17 | |
20 | 18 | class CrudController extends BaseController |
21 | 19 | { |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | // show a success message |
127 | 127 | if($this->crud->model::find($item->id)) |
128 | - \Alert::success(trans('backpack::crud.insert_success'))->flash(); |
|
128 | + \Alert::success(trans('backpack::crud.insert_success'))->flash(); |
|
129 | 129 | |
130 | 130 | // save the redirect choice for next time |
131 | 131 | $this->setSaveAction(); |
@@ -159,18 +159,18 @@ discard block |
||
159 | 159 | if($this->crud->eagerLoad && !empty($this->crud->eagerLoad)) |
160 | 160 | foreach($this->crud->eagerLoad as $relation_name) |
161 | 161 | { |
162 | - if($this->data['entry'] && $rel = $this->data['entry']->{$relation_name}) |
|
163 | - { |
|
164 | - foreach($this->data['fields'] as $field_name => $field) |
|
165 | - { |
|
166 | - if(starts_with($field_name, $relation_name)) |
|
167 | - { |
|
162 | + if($this->data['entry'] && $rel = $this->data['entry']->{$relation_name}) |
|
163 | + { |
|
164 | + foreach($this->data['fields'] as $field_name => $field) |
|
165 | + { |
|
166 | + if(starts_with($field_name, $relation_name)) |
|
167 | + { |
|
168 | 168 | $column_name = str_replace("{$relation_name}.", '', $field_name); |
169 | 169 | |
170 | 170 | $this->data['fields'][$field_name]['value'] = $rel->{$column_name}; |
171 | - } |
|
172 | - } |
|
173 | - } |
|
171 | + } |
|
172 | + } |
|
173 | + } |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | // load the view from /resources/views/vendor/backpack/crud/ if it exists, otherwise load the one in the package |
@@ -271,23 +271,23 @@ discard block |
||
271 | 271 | |
272 | 272 | public function handleEagerLoad($item) |
273 | 273 | { |
274 | - collect($this->crud->eagerLoad)->each(function($relation_name, $key) use ($item) |
|
275 | - { |
|
276 | - $data = collect(request()->all()) |
|
277 | - ->filter(function($value, $key) use ($relation_name) |
|
278 | - { |
|
279 | - return starts_with($key, $relation_name); |
|
280 | - }) |
|
281 | - ->mapWithKeys(function($value, $key) use ($relation_name) |
|
282 | - { |
|
283 | - return [str_replace("{$relation_name}_", '', $key) => $value ?? '']; |
|
284 | - }) |
|
285 | - ->toArray(); |
|
286 | - |
|
287 | - if(!$rel = $item->{$relation_name}) |
|
288 | - $item->{$relation_name}()->create($data); |
|
289 | - else |
|
290 | - $item->{$relation_name}->update($data); |
|
291 | - }); |
|
274 | + collect($this->crud->eagerLoad)->each(function($relation_name, $key) use ($item) |
|
275 | + { |
|
276 | + $data = collect(request()->all()) |
|
277 | + ->filter(function($value, $key) use ($relation_name) |
|
278 | + { |
|
279 | + return starts_with($key, $relation_name); |
|
280 | + }) |
|
281 | + ->mapWithKeys(function($value, $key) use ($relation_name) |
|
282 | + { |
|
283 | + return [str_replace("{$relation_name}_", '', $key) => $value ?? '']; |
|
284 | + }) |
|
285 | + ->toArray(); |
|
286 | + |
|
287 | + if(!$rel = $item->{$relation_name}) |
|
288 | + $item->{$relation_name}()->create($data); |
|
289 | + else |
|
290 | + $item->{$relation_name}->update($data); |
|
291 | + }); |
|
292 | 292 | } |
293 | 293 | } |
@@ -33,13 +33,13 @@ discard block |
||
33 | 33 | |
34 | 34 | public function __construct() |
35 | 35 | { |
36 | - if (! $this->crud) { |
|
36 | + if (!$this->crud) { |
|
37 | 37 | $this->crud = app()->make(CrudPanel::class); |
38 | - $this->crud->ajax_table=false; |
|
38 | + $this->crud->ajax_table = false; |
|
39 | 39 | |
40 | 40 | // call the setup function inside this closure to also have the request there |
41 | 41 | // this way, developers can use things stored in session (auth variables, etc) |
42 | - $this->middleware(function ($request, $next) { |
|
42 | + $this->middleware(function($request, $next) { |
|
43 | 43 | $this->request = $request; |
44 | 44 | $this->crud->request = $request; |
45 | 45 | $this->setup(); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $this->data['title'] = ucfirst($this->crud->entity_name_plural); |
70 | 70 | |
71 | 71 | // get all entries if AJAX is not enabled |
72 | - if (! $this->data['crud']->ajaxTable()) { |
|
72 | + if (!$this->data['crud']->ajaxTable()) { |
|
73 | 73 | $this->data['entries'] = $this->data['crud']->getEntries(); |
74 | 74 | } |
75 | 75 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $this->data['entry'] = $this->crud->entry = $item; |
125 | 125 | |
126 | 126 | // show a success message |
127 | - if($this->crud->model::find($item->id)) |
|
127 | + if ($this->crud->model::find($item->id)) |
|
128 | 128 | \Alert::success(trans('backpack::crud.insert_success'))->flash(); |
129 | 129 | |
130 | 130 | // save the redirect choice for next time |
@@ -156,14 +156,14 @@ discard block |
||
156 | 156 | |
157 | 157 | $this->data['id'] = $id; |
158 | 158 | |
159 | - if($this->crud->eagerLoad && !empty($this->crud->eagerLoad)) |
|
160 | - foreach($this->crud->eagerLoad as $relation_name) |
|
159 | + if ($this->crud->eagerLoad && !empty($this->crud->eagerLoad)) |
|
160 | + foreach ($this->crud->eagerLoad as $relation_name) |
|
161 | 161 | { |
162 | - if($this->data['entry'] && $rel = $this->data['entry']->{$relation_name}) |
|
162 | + if ($this->data['entry'] && $rel = $this->data['entry']->{$relation_name}) |
|
163 | 163 | { |
164 | - foreach($this->data['fields'] as $field_name => $field) |
|
164 | + foreach ($this->data['fields'] as $field_name => $field) |
|
165 | 165 | { |
166 | - if(starts_with($field_name, $relation_name)) |
|
166 | + if (starts_with($field_name, $relation_name)) |
|
167 | 167 | { |
168 | 168 | $column_name = str_replace("{$relation_name}.", '', $field_name); |
169 | 169 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | }) |
285 | 285 | ->toArray(); |
286 | 286 | |
287 | - if(!$rel = $item->{$relation_name}) |
|
287 | + if (!$rel = $item->{$relation_name}) |
|
288 | 288 | $item->{$relation_name}()->create($data); |
289 | 289 | else |
290 | 290 | $item->{$relation_name}->update($data); |
@@ -124,8 +124,9 @@ discard block |
||
124 | 124 | $this->data['entry'] = $this->crud->entry = $item; |
125 | 125 | |
126 | 126 | // show a success message |
127 | - if($this->crud->model::find($item->id)) |
|
128 | - \Alert::success(trans('backpack::crud.insert_success'))->flash(); |
|
127 | + if($this->crud->model::find($item->id)) { |
|
128 | + \Alert::success(trans('backpack::crud.insert_success'))->flash(); |
|
129 | + } |
|
129 | 130 | |
130 | 131 | // save the redirect choice for next time |
131 | 132 | $this->setSaveAction(); |
@@ -156,8 +157,8 @@ discard block |
||
156 | 157 | |
157 | 158 | $this->data['id'] = $id; |
158 | 159 | |
159 | - if($this->crud->eagerLoad && !empty($this->crud->eagerLoad)) |
|
160 | - foreach($this->crud->eagerLoad as $relation_name) |
|
160 | + if($this->crud->eagerLoad && !empty($this->crud->eagerLoad)) { |
|
161 | + foreach($this->crud->eagerLoad as $relation_name) |
|
161 | 162 | { |
162 | 163 | if($this->data['entry'] && $rel = $this->data['entry']->{$relation_name}) |
163 | 164 | { |
@@ -166,6 +167,7 @@ discard block |
||
166 | 167 | if(starts_with($field_name, $relation_name)) |
167 | 168 | { |
168 | 169 | $column_name = str_replace("{$relation_name}.", '', $field_name); |
170 | + } |
|
169 | 171 | |
170 | 172 | $this->data['fields'][$field_name]['value'] = $rel->{$column_name}; |
171 | 173 | } |
@@ -284,10 +286,11 @@ discard block |
||
284 | 286 | }) |
285 | 287 | ->toArray(); |
286 | 288 | |
287 | - if(!$rel = $item->{$relation_name}) |
|
288 | - $item->{$relation_name}()->create($data); |
|
289 | - else |
|
290 | - $item->{$relation_name}->update($data); |
|
289 | + if(!$rel = $item->{$relation_name}) { |
|
290 | + $item->{$relation_name}()->create($data); |
|
291 | + } else { |
|
292 | + $item->{$relation_name}->update($data); |
|
293 | + } |
|
291 | 294 | }); |
292 | 295 | } |
293 | 296 | } |
@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace Backpack\CRUD; |
4 | 4 | |
5 | -use Route; |
|
6 | 5 | use Illuminate\Support\ServiceProvider; |
7 | 6 | |
8 | 7 | class CrudServiceProvider extends ServiceProvider |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function register() |
78 | 78 | { |
79 | - $this->app->bind('CRUD', function ($app) { |
|
79 | + $this->app->bind('CRUD', function($app) { |
|
80 | 80 | return new CRUD($app); |
81 | 81 | }); |
82 | 82 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $this->commands($this->commands); |
92 | 92 | |
93 | 93 | // map the elfinder prefix |
94 | - if (! \Config::get('elfinder.route.prefix')) { |
|
94 | + if (!\Config::get('elfinder.route.prefix')) { |
|
95 | 95 | \Config::set('elfinder.route.prefix', \Config::get('backpack.base.route_prefix').'/elfinder'); |
96 | 96 | } |
97 | 97 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | { |
112 | 112 | $crudPubPath = public_path('vendor/backpack/crud'); |
113 | 113 | |
114 | - if (! is_dir($crudPubPath)) { |
|
114 | + if (!is_dir($crudPubPath)) { |
|
115 | 115 | return true; |
116 | 116 | } |
117 | 117 |