We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -41,7 +41,7 @@ |
||
41 | 41 | $this->crud->hasAccessOrFail('revisions'); |
42 | 42 | |
43 | 43 | $revisionId = \Request::input('revision_id', false); |
44 | - if (! $revisionId) { |
|
44 | + if (!$revisionId) { |
|
45 | 45 | abort(500, 'Can\'t restore revision without revision_id'); |
46 | 46 | } else { |
47 | 47 | $this->crud->restoreRevision($id, $revisionId); // do the update |
@@ -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 | { |
@@ -33,12 +33,12 @@ |
||
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 | 38 | |
39 | 39 | // call the setup function inside this closure to also have the request there |
40 | 40 | // this way, developers can use things stored in session (auth variables, etc) |
41 | - $this->middleware(function ($request, $next) { |
|
41 | + $this->middleware(function($request, $next) { |
|
42 | 42 | $this->request = $request; |
43 | 43 | $this->crud->request = $request; |
44 | 44 | $this->setup(); |
@@ -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 |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function register() |
76 | 76 | { |
77 | - $this->app->bind('CRUD', function ($app) { |
|
77 | + $this->app->bind('CRUD', function($app) { |
|
78 | 78 | return new CRUD($app); |
79 | 79 | }); |
80 | 80 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $loader->alias('Image', \Intervention\Image\Facades\Image::class); |
93 | 93 | |
94 | 94 | // map the elfinder prefix |
95 | - if (! \Config::get('elfinder.route.prefix')) { |
|
95 | + if (!\Config::get('elfinder.route.prefix')) { |
|
96 | 96 | \Config::set('elfinder.route.prefix', \Config::get('backpack.base.route_prefix').'/elfinder'); |
97 | 97 | } |
98 | 98 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | { |
113 | 113 | $crudPubPath = public_path('vendor/backpack/crud'); |
114 | 114 | |
115 | - if (! is_dir($crudPubPath)) { |
|
115 | + if (!is_dir($crudPubPath)) { |
|
116 | 116 | return true; |
117 | 117 | } |
118 | 118 |
@@ -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 |
@@ -24,7 +24,7 @@ |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | //for update form, get initial state of the entity |
27 | - if( isset($id) && $id ){ |
|
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']) |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | public function tabsDisabled() |
31 | 31 | { |
32 | - return ! $this->tabsEnabled; |
|
32 | + return !$this->tabsEnabled; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | public function setTabsType($type) |
@@ -91,8 +91,8 @@ discard block |
||
91 | 91 | { |
92 | 92 | $all_fields = $this->getCurrentFields(); |
93 | 93 | |
94 | - $fields_without_a_tab = collect($all_fields)->filter(function ($value, $key) { |
|
95 | - return ! isset($value['tab']); |
|
94 | + $fields_without_a_tab = collect($all_fields)->filter(function($value, $key) { |
|
95 | + return !isset($value['tab']); |
|
96 | 96 | }); |
97 | 97 | |
98 | 98 | return $fields_without_a_tab; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | if ($this->tabExists($label)) { |
104 | 104 | $all_fields = $this->getCurrentFields(); |
105 | 105 | |
106 | - $fields_for_current_tab = collect($all_fields)->filter(function ($value, $key) use ($label) { |
|
106 | + $fields_for_current_tab = collect($all_fields)->filter(function($value, $key) use ($label) { |
|
107 | 107 | return isset($value['tab']) && $value['tab'] == $label; |
108 | 108 | }); |
109 | 109 | |
@@ -119,11 +119,11 @@ discard block |
||
119 | 119 | $fields = $this->getCurrentFields(); |
120 | 120 | |
121 | 121 | $fields_with_tabs = collect($fields) |
122 | - ->filter(function ($value, $key) { |
|
122 | + ->filter(function($value, $key) { |
|
123 | 123 | return isset($value['tab']); |
124 | 124 | }) |
125 | - ->each(function ($value, $key) use (&$tabs) { |
|
126 | - if (! in_array($value['tab'], $tabs)) { |
|
125 | + ->each(function($value, $key) use (&$tabs) { |
|
126 | + if (!in_array($value['tab'], $tabs)) { |
|
127 | 127 | $tabs[] = $value['tab']; |
128 | 128 | } |
129 | 129 | }); |
@@ -22,6 +22,9 @@ |
||
22 | 22 | return $this->tabsEnabled; |
23 | 23 | } |
24 | 24 | |
25 | + /** |
|
26 | + * @return boolean |
|
27 | + */ |
|
25 | 28 | public function tabsEnabled() |
26 | 29 | { |
27 | 30 | return $this->tabsEnabled; |
@@ -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', |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function setModel($model_namespace) |
86 | 86 | { |
87 | - if (! class_exists($model_namespace)) { |
|
87 | + if (!class_exists($model_namespace)) { |
|
88 | 88 | throw new \Exception('This model does not exist.', 404); |
89 | 89 | } |
90 | 90 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | { |
126 | 126 | $complete_route = $route.'.index'; |
127 | 127 | |
128 | - if (! \Route::has($complete_route)) { |
|
128 | + if (!\Route::has($complete_route)) { |
|
129 | 129 | throw new \Exception('There are no routes for this route name.', 404); |
130 | 130 | } |
131 | 131 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function getFirstOfItsTypeInArray($type, $array) |
177 | 177 | { |
178 | - return array_first($array, function ($item) use ($type) { |
|
178 | + return array_first($array, function($item) use ($type) { |
|
179 | 179 | return $item['type'] == $type; |
180 | 180 | }); |
181 | 181 | } |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | |
193 | 193 | public function sync($type, $fields, $attributes) |
194 | 194 | { |
195 | - if (! empty($this->{$type})) { |
|
196 | - $this->{$type} = array_map(function ($field) use ($fields, $attributes) { |
|
195 | + if (!empty($this->{$type})) { |
|
196 | + $this->{$type} = array_map(function($field) use ($fields, $attributes) { |
|
197 | 197 | if (in_array($field['name'], (array) $fields)) { |
198 | 198 | $field = array_merge($field, $attributes); |
199 | 199 | } |
@@ -219,8 +219,8 @@ discard block |
||
219 | 219 | } |
220 | 220 | } |
221 | 221 | |
222 | - return $this->{$items} = array_merge($elements, array_filter($this->{$items}, function ($item) use ($items) { |
|
223 | - return ! in_array($item['name'], $this->sort[$items]); |
|
222 | + return $this->{$items} = array_merge($elements, array_filter($this->{$items}, function($item) use ($items) { |
|
223 | + return !in_array($item['name'], $this->sort[$items]); |
|
224 | 224 | })); |
225 | 225 | } |
226 | 226 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | */ |
244 | 244 | private function getRelationModel($relationString) |
245 | 245 | { |
246 | - $result = array_reduce(explode('.', $relationString), function ($obj, $method) { |
|
246 | + $result = array_reduce(explode('.', $relationString), function($obj, $method) { |
|
247 | 247 | return $obj->$method()->getRelated(); |
248 | 248 | }, $this->model); |
249 | 249 |
@@ -123,6 +123,7 @@ |
||
123 | 123 | * |
124 | 124 | * @param [string] Route name. |
125 | 125 | * @param [array] Parameters. |
126 | + * @param string $route |
|
126 | 127 | */ |
127 | 128 | public function setRouteName($route, $parameters = []) |
128 | 129 | { |
@@ -2,25 +2,25 @@ |
||
2 | 2 | |
3 | 3 | namespace Backpack\CRUD; |
4 | 4 | |
5 | -use Backpack\CRUD\PanelTraits\Read; |
|
6 | -use Backpack\CRUD\PanelTraits\Tabs; |
|
7 | -use Backpack\CRUD\PanelTraits\Query; |
|
8 | -use Backpack\CRUD\PanelTraits\Views; |
|
9 | 5 | use Backpack\CRUD\PanelTraits\Access; |
6 | +use Backpack\CRUD\PanelTraits\AutoFocus; |
|
7 | +use Backpack\CRUD\PanelTraits\AutoSet; |
|
8 | +use Backpack\CRUD\PanelTraits\Buttons; |
|
9 | +use Backpack\CRUD\PanelTraits\Columns; |
|
10 | 10 | use Backpack\CRUD\PanelTraits\Create; |
11 | 11 | use Backpack\CRUD\PanelTraits\Delete; |
12 | 12 | use Backpack\CRUD\PanelTraits\Errors; |
13 | +use Backpack\CRUD\PanelTraits\FakeColumns; |
|
14 | +use Backpack\CRUD\PanelTraits\FakeFields; |
|
13 | 15 | use Backpack\CRUD\PanelTraits\Fields; |
14 | -use Backpack\CRUD\PanelTraits\Search; |
|
15 | -use Backpack\CRUD\PanelTraits\Update; |
|
16 | -use Backpack\CRUD\PanelTraits\AutoSet; |
|
17 | -use Backpack\CRUD\PanelTraits\Buttons; |
|
18 | -use Backpack\CRUD\PanelTraits\Columns; |
|
19 | 16 | use Backpack\CRUD\PanelTraits\Filters; |
17 | +use Backpack\CRUD\PanelTraits\Query; |
|
18 | +use Backpack\CRUD\PanelTraits\Read; |
|
20 | 19 | use Backpack\CRUD\PanelTraits\Reorder; |
21 | -use Backpack\CRUD\PanelTraits\AutoFocus; |
|
22 | -use Backpack\CRUD\PanelTraits\FakeFields; |
|
23 | -use Backpack\CRUD\PanelTraits\FakeColumns; |
|
20 | +use Backpack\CRUD\PanelTraits\Search; |
|
21 | +use Backpack\CRUD\PanelTraits\Tabs; |
|
22 | +use Backpack\CRUD\PanelTraits\Update; |
|
23 | +use Backpack\CRUD\PanelTraits\Views; |
|
24 | 24 | use Backpack\CRUD\PanelTraits\ViewsAndRestoresRevisions; |
25 | 25 | |
26 | 26 | class CrudPanel |
@@ -24,19 +24,19 @@ |
||
24 | 24 | if (isset($field['fake']) && $field['fake'] == true) { |
25 | 25 | // add it to the request in its appropriate variable - the one defined, if defined |
26 | 26 | if (isset($field['store_in'])) { |
27 | - if (! in_array($field['store_in'], $fakeFieldsColumnsArray, true)) { |
|
27 | + if (!in_array($field['store_in'], $fakeFieldsColumnsArray, true)) { |
|
28 | 28 | array_push($fakeFieldsColumnsArray, $field['store_in']); |
29 | 29 | } |
30 | 30 | } else { |
31 | 31 | //otherwise in the one defined in the $crud variable |
32 | - if (! in_array('extras', $fakeFieldsColumnsArray, true)) { |
|
32 | + if (!in_array('extras', $fakeFieldsColumnsArray, true)) { |
|
33 | 33 | array_push($fakeFieldsColumnsArray, 'extras'); |
34 | 34 | } |
35 | 35 | } |
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
39 | - if (! count($fakeFieldsColumnsArray)) { |
|
39 | + if (!count($fakeFieldsColumnsArray)) { |
|
40 | 40 | $fakeFieldsColumnsArray = ['extras']; |
41 | 41 | } |
42 | 42 |
@@ -9,7 +9,7 @@ |
||
9 | 9 | * been found. |
10 | 10 | * |
11 | 11 | * @param string $form The CRUD form. Can be 'create', 'update' or 'both'. Default is 'create'. |
12 | - * @param int|bool $id Optional entity ID needed in the case of the update form. |
|
12 | + * @param integer $id Optional entity ID needed in the case of the update form. |
|
13 | 13 | * @return array The fake columns array. |
14 | 14 | */ |
15 | 15 | public function getFakeColumnsAsArray($form = 'create', $id = false) |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function removeButton($name, $stack = null) |
96 | 96 | { |
97 | - $this->buttons = $this->buttons->reject(function ($button) use ($name, $stack) { |
|
97 | + $this->buttons = $this->buttons->reject(function($button) use ($name, $stack) { |
|
98 | 98 | return $stack == null ? $button->name == $name : ($button->stack == $stack) && ($button->name == $name); |
99 | 99 | }); |
100 | 100 | } |
@@ -106,14 +106,14 @@ discard block |
||
106 | 106 | |
107 | 107 | public function removeAllButtonsFromStack($stack) |
108 | 108 | { |
109 | - $this->buttons = $this->buttons->reject(function ($button) use ($stack) { |
|
109 | + $this->buttons = $this->buttons->reject(function($button) use ($stack) { |
|
110 | 110 | return $button->stack == $stack; |
111 | 111 | }); |
112 | 112 | } |
113 | 113 | |
114 | 114 | public function removeButtonFromStack($name, $stack) |
115 | 115 | { |
116 | - $this->buttons = $this->buttons->reject(function ($button) use ($name, $stack) { |
|
116 | + $this->buttons = $this->buttons->reject(function($button) use ($name, $stack) { |
|
117 | 117 | return $button->name == $name && $button->stack == $stack; |
118 | 118 | }); |
119 | 119 | } |
@@ -59,6 +59,9 @@ discard block |
||
59 | 59 | $this->addButton($stack, $name, 'model_function', $model_function_name, $position); |
60 | 60 | } |
61 | 61 | |
62 | + /** |
|
63 | + * @param string $view |
|
64 | + */ |
|
62 | 65 | public function addButtonFromView($stack, $name, $view, $position = false) |
63 | 66 | { |
64 | 67 | $view = 'vendor.backpack.crud.buttons.'.$view; |
@@ -104,6 +107,9 @@ discard block |
||
104 | 107 | $this->buttons = collect([]); |
105 | 108 | } |
106 | 109 | |
110 | + /** |
|
111 | + * @param string $stack |
|
112 | + */ |
|
107 | 113 | public function removeAllButtonsFromStack($stack) |
108 | 114 | { |
109 | 115 | $this->buttons = $this->buttons->reject(function ($button) use ($stack) { |
@@ -126,6 +132,12 @@ discard block |
||
126 | 132 | public $type = 'view'; |
127 | 133 | public $content; |
128 | 134 | |
135 | + /** |
|
136 | + * @param string $stack |
|
137 | + * @param string $name |
|
138 | + * @param string $type |
|
139 | + * @param string $content |
|
140 | + */ |
|
129 | 141 | public function __construct($stack, $name, $type, $content) |
130 | 142 | { |
131 | 143 | $this->stack = $stack; |