We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -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 | { |
@@ -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 | { |
@@ -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 | } |
@@ -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 |
@@ -23,13 +23,13 @@ |
||
23 | 23 | } |
24 | 24 | } |
25 | 25 | |
26 | - //for update form, get initial state of the entity |
|
27 | - if( isset($id) && $id ){ |
|
26 | + //for update form, get initial state of the entity |
|
27 | + if( isset($id) && $id ){ |
|
28 | 28 | |
29 | 29 | //get entity with relations for primary dependency |
30 | 30 | $entity_dependencies = $entity_model->with($primary_dependency['entity']) |
31 | - ->with($primary_dependency['entity'].'.'.$primary_dependency['entity_secondary']) |
|
32 | - ->find($id); |
|
31 | + ->with($primary_dependency['entity'].'.'.$primary_dependency['entity_secondary']) |
|
32 | + ->find($id); |
|
33 | 33 | |
34 | 34 | $secondaries_from_primary = []; |
35 | 35 |
@@ -65,7 +65,7 @@ |
||
65 | 65 | 'delete_confirmation_not_deleted_title' => 'Não apagado', |
66 | 66 | 'delete_confirmation_not_deleted_message' => 'Está tudo bem!. O item não foi apagado.', |
67 | 67 | |
68 | - // DataTables translation |
|
68 | + // DataTables translation |
|
69 | 69 | 'emptyTable' => 'Sem dados disponíveis na tabela', |
70 | 70 | 'info' => 'A mostrar _START_ a _END_ de _TOTAL_ registos', |
71 | 71 | 'infoEmpty' => 'A mostrar 0 a 0 de 0 registos', |
@@ -2,9 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace Backpack\CRUD\Tests\Unit\CrudPanel; |
4 | 4 | |
5 | -use Faker\Factory; |
|
6 | -use Backpack\CRUD\Tests\Unit\Models\User; |
|
7 | 5 | use Backpack\CRUD\Tests\Unit\Models\Article; |
6 | +use Backpack\CRUD\Tests\Unit\Models\User; |
|
7 | +use Faker\Factory; |
|
8 | 8 | |
9 | 9 | class CrudPanelCreateTest extends BaseDBCrudPanelTest |
10 | 10 | { |
@@ -2,9 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace Backpack\CRUD\Tests\Unit\CrudPanel; |
4 | 4 | |
5 | -use Illuminate\Support\Facades\DB; |
|
6 | 5 | use Backpack\CRUD\Tests\Unit\Models\Article; |
7 | 6 | use Illuminate\Database\Eloquent\ModelNotFoundException; |
7 | +use Illuminate\Support\Facades\DB; |
|
8 | 8 | |
9 | 9 | class CrudPanelDeleteTest extends BaseDBCrudPanelTest |
10 | 10 | { |
@@ -2,11 +2,11 @@ |
||
2 | 2 | |
3 | 3 | namespace Backpack\CRUD\Tests\Unit\CrudPanel; |
4 | 4 | |
5 | -use Illuminate\Support\Collection; |
|
6 | -use Illuminate\Support\Facades\DB; |
|
7 | -use Backpack\CRUD\Tests\Unit\Models\User; |
|
8 | 5 | use Backpack\CRUD\Tests\Unit\Models\Article; |
6 | +use Backpack\CRUD\Tests\Unit\Models\User; |
|
9 | 7 | use Illuminate\Database\Eloquent\ModelNotFoundException; |
8 | +use Illuminate\Support\Collection; |
|
9 | +use Illuminate\Support\Facades\DB; |
|
10 | 10 | |
11 | 11 | class CrudPanelReadTest extends BaseDBCrudPanelTest |
12 | 12 | { |