Issues (82)

app/Admin/Sections/Settings.php (5 issues)

1
<?php
2
3
namespace App\Admin\Sections;
4
5
use AdminColumn;
0 ignored issues
show
The type AdminColumn was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use AdminDisplay;
0 ignored issues
show
The type AdminDisplay was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use AdminForm;
0 ignored issues
show
The type AdminForm was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use AdminFormElement;
0 ignored issues
show
The type AdminFormElement was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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 Settings extends Section implements Initializable
16
{
17
    public function initialize()
18
    {
19
    }
20
21
    protected $checkAccess = true;
22
    protected $alias = 'settings';
23
24
    public function getIcon()
25
    {
26
        return 'fas fa-cog';
27
    }
28
29
    public function getTitle()
30
    {
31
        return 'Настройки';
32
    }
33
34
    public function getEditTitle()
35
    {
36
        return 'Редактирование настройки сайта';
37
    }
38
39
    public function onDisplay()
40
    {
41
        $display = AdminDisplay::table()
42
      ->setHtmlAttribute('class', 'table-danger table-hover');
43
44
        $display->setColumns([
45
      // AdminColumn::text('id', '#')
46
      //   ->setWidth('50px'),
47
      AdminColumn::link('name', 'Настройка')
48
        ->setWidth('150px'),
49
      AdminColumn::boolean('value', 'Состояние')
50
        ->setWidth('130px')
51
        ->setOrderable(true),
52
      AdminColumn::text('description', 'Описание'),
53
      AdminColumn::text('updated_at', 'Изменен', 'editors.name')
54
        ->setWidth('160px')
55
        ->setSearchable(false)
56
        ->setOrderable(true),
57
    ]);
58
59
        return $display;
60
    }
61
62
    public function onEdit($id)
0 ignored issues
show
The parameter $id is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

62
    public function onEdit(/** @scrutinizer ignore-unused */ $id)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
63
    {
64
        $form = AdminForm::panel()->addBody([
65
      AdminFormElement::columns()->addColumn([
66
        AdminFormElement::text('name', 'Название')
67
          ->setReadonly(1)
68
          ->required(),
69
        AdminFormElement::textarea('description', 'Описание')
70
          ->setRows(3)
71
          ->addValidationRule('max:190', __('adm.valid.max190')),
72
        AdminFormElement::html('<hr>'),
73
        AdminFormElement::checkbox('value', 'Состояние настройки'),
74
      ], 8)->addColumn([
75
        AdminFormElement::text('creators.name', 'Создал')
76
          ->setReadonly(1),
77
        AdminFormElement::text('updated_at', 'Создано')
78
          ->setReadonly(1),
79
        AdminFormElement::html('<hr>'),
80
        AdminFormElement::text('editors.name', 'Редактировал')
81
          ->setReadonly(1),
82
        AdminFormElement::text('updated_at', 'Редакция')
83
          ->setReadonly(1),
84
      ]),
85
    ]);
86
87
        $form->getButtons()->setButtons([
88
      // 'save'  => new Save(),
89
      'save_and_close'  => new SaveAndClose(),
90
      'cancel'          => (new Cancel()),
91
    ]);
92
93
        return $form;
94
    }
95
}
96