|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Epesi\Core\HomePage; |
|
4
|
|
|
|
|
5
|
|
|
use Epesi\Core\System\Modules\ModuleView; |
|
6
|
|
|
use Illuminate\Support\Facades\Auth; |
|
7
|
|
|
use Epesi\Core\Layout\View\ActionBar; |
|
8
|
|
|
use atk4\ui\GridPlugin\Filter; |
|
|
|
|
|
|
9
|
|
|
use atk4\ui\Crud; |
|
10
|
|
|
|
|
11
|
|
|
class HomePageSettings extends ModuleView |
|
12
|
|
|
{ |
|
13
|
|
|
protected $label = 'Home Page Administration'; |
|
14
|
|
|
|
|
15
|
|
|
public static function access() |
|
16
|
|
|
{ |
|
17
|
|
|
return Auth::user()->can('modify system settings') && Model\HomePage::list(); |
|
18
|
|
|
} |
|
19
|
|
|
|
|
20
|
|
|
public function body() |
|
21
|
|
|
{ |
|
22
|
|
|
ActionBar::addItemButton('back')->link(url('view/system')); |
|
23
|
|
|
|
|
24
|
|
|
$grid = $this->add([ |
|
25
|
|
|
Crud::class, |
|
26
|
|
|
'menu' => ActionBar::instance(), |
|
27
|
|
|
// 'model' => HomePage::create(), |
|
28
|
|
|
'displayFields' => ['path', 'role'], |
|
29
|
|
|
'editFields' => ['path', 'role'], |
|
30
|
|
|
'notifyDefault' => ['jsNotify', 'content' => __('Data is saved!'), 'color' => 'green'], |
|
31
|
|
|
'paginator' => false, |
|
32
|
|
|
// 'plugins' => [ |
|
33
|
|
|
// 'quickSearch' => true,//['path', 'role'], |
|
34
|
|
|
// 'paginator' => false |
|
35
|
|
|
// ] |
|
36
|
|
|
]); |
|
37
|
|
|
|
|
38
|
|
|
$grid->setModel(Model\HomePage::create()); |
|
|
|
|
|
|
39
|
|
|
|
|
40
|
|
|
// $grid->model->getField('path')->ui['filter'] = [ |
|
41
|
|
|
// 'values' => ['aa', 'bb'], |
|
42
|
|
|
// 'callback' => function($plugin, $value) { |
|
43
|
|
|
// $plugin->owner->model->addCondition('path', 'view/dashboard'); |
|
44
|
|
|
// } |
|
45
|
|
|
// ]; |
|
46
|
|
|
|
|
47
|
|
|
// $grid->add(Filter::class); |
|
48
|
|
|
|
|
49
|
|
|
// $grid->getElement('filter')->form->addField('test', ['CheckBox', 'ui' => ['filter' => ['callback' => function($filter, $key, $value){$filter->owner->model->addCondition('path', null);}]]]); |
|
50
|
|
|
|
|
51
|
|
|
// $plugin->extendList('path'); |
|
52
|
|
|
|
|
53
|
|
|
$grid->addDragHandler()->onReorder(function ($order) { |
|
|
|
|
|
|
54
|
|
|
foreach (Model\HomePage::create() as $homepage) { |
|
55
|
|
|
$homepage->save(['priority' => array_search($homepage['id'], $order)]); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
return $this->notifySuccess(__('Homepages reordered!')); |
|
59
|
|
|
}); |
|
60
|
|
|
} |
|
61
|
|
|
} |
|
62
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths