1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Admin\Sections; |
4
|
|
|
|
5
|
|
|
use AdminColumn; |
|
|
|
|
6
|
|
|
use AdminDisplay; |
|
|
|
|
7
|
|
|
use AdminForm; |
|
|
|
|
8
|
|
|
use AdminFormElement; |
|
|
|
|
9
|
|
|
use SleepingOwl\Admin\Contracts\Initializable; |
10
|
|
|
use SleepingOwl\Admin\Form\Buttons\Cancel; |
11
|
|
|
//use SleepingOwl\Admin\Form\Buttons\Save; |
12
|
|
|
use SleepingOwl\Admin\Form\Buttons\SaveAndClose; |
13
|
|
|
use SleepingOwl\Admin\Section; |
14
|
|
|
|
15
|
|
|
class Scripts extends Section implements Initializable |
16
|
|
|
{ |
17
|
|
|
public function initialize() |
18
|
|
|
{ |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
protected $checkAccess = true; |
22
|
|
|
protected $alias = 'scripts'; |
23
|
|
|
|
24
|
|
|
public function getIcon() |
25
|
|
|
{ |
26
|
|
|
return 'fas fa-file-code'; |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
public function getTitle() |
30
|
|
|
{ |
31
|
|
|
return 'Виджеты'; |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function getEditTitle() |
35
|
|
|
{ |
36
|
|
|
return 'Редактирование виджета (скрипта)'; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function getCreateTitle() |
40
|
|
|
{ |
41
|
|
|
return 'Создание нового виджета (скрипта)'; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
public function onDisplay() |
45
|
|
|
{ |
46
|
|
|
$display = AdminDisplay::datatables() |
47
|
|
|
->setHtmlAttribute('class', 'table-success table-hover') |
48
|
|
|
->setDisplaySearch(true); |
49
|
|
|
|
50
|
|
|
$display->setColumns([ |
51
|
|
|
AdminColumn::text('id', '#') |
52
|
|
|
->setWidth('50px') |
53
|
|
|
->setHtmlAttribute('class', 'text-center'), |
54
|
|
|
AdminColumn::link('name', 'Название'), |
55
|
|
|
AdminColumn::boolean('active', 'ВКЛ'), |
56
|
|
|
AdminColumn::boolean('top', 'Header') |
57
|
|
|
->setWidth('110px') |
58
|
|
|
->setOrderable(true), |
59
|
|
|
AdminColumn::text('updated_at', 'Изменен', 'editors.name') |
60
|
|
|
->setWidth('160px') |
61
|
|
|
->setSearchable(false) |
62
|
|
|
->setOrderable(false), |
63
|
|
|
]); |
64
|
|
|
|
65
|
|
|
return $display; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
public function onEdit($id) |
|
|
|
|
69
|
|
|
{ |
70
|
|
|
$form = AdminForm::panel()->addBody([ |
71
|
|
|
AdminFormElement::columns()->addColumn([ |
72
|
|
|
AdminFormElement::text('name', 'Название скрипта') |
73
|
|
|
->addValidationRule('max:190', __('adm.valid.max190')) |
74
|
|
|
->required(), |
75
|
|
|
AdminFormElement::textarea('data', 'Данные') |
76
|
|
|
->setRows(8), |
77
|
|
|
AdminFormElement::checkbox('active', 'ВКЛ'), |
78
|
|
|
AdminFormElement::html('<hr>'), |
79
|
|
|
AdminFormElement::checkbox('top', 'В шапку сайта (иначе в конец документа)'), |
80
|
|
|
], 8)->addColumn([ |
81
|
|
|
AdminFormElement::text('id', '#') |
82
|
|
|
->setReadonly(1), |
83
|
|
|
AdminFormElement::text('creators.name', 'Создал') |
84
|
|
|
->setReadonly(1), |
85
|
|
|
AdminFormElement::text('updated_at', 'Создано') |
86
|
|
|
->setReadonly(1), |
87
|
|
|
AdminFormElement::html('<hr>'), |
88
|
|
|
AdminFormElement::text('editors.name', 'Редактировал') |
89
|
|
|
->setReadonly(1), |
90
|
|
|
AdminFormElement::text('updated_at', 'Редакция') |
91
|
|
|
->setReadonly(1), |
92
|
|
|
]), |
93
|
|
|
]); |
94
|
|
|
|
95
|
|
|
$form->getButtons()->setButtons([ |
96
|
|
|
// 'save' => new Save(), |
97
|
|
|
'save_and_close' => new SaveAndClose(), |
98
|
|
|
'cancel' => (new Cancel()), |
99
|
|
|
]); |
100
|
|
|
|
101
|
|
|
return $form; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
public function onCreate() |
105
|
|
|
{ |
106
|
|
|
return $this->onEdit(null); |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
public function onDelete($id) |
|
|
|
|
110
|
|
|
{ |
111
|
|
|
} |
112
|
|
|
} |
113
|
|
|
|
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