Issues (48)

src/Adapter/AnnouncementAdapter.php (3 issues)

Labels
Severity
1
<?php
2
3
namespace Adminetic\Announcement\Adapter;
4
5
use Pratiksh\Adminetic\Contracts\PluginInterface;
0 ignored issues
show
The type Pratiksh\Adminetic\Contracts\PluginInterface 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 Pratiksh\Adminetic\Traits\SidebarHelper;
0 ignored issues
show
The type Pratiksh\Adminetic\Traits\SidebarHelper 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
8
class AnnouncementAdapter implements PluginInterface
9
{
10
    use SidebarHelper;
11
12
    public function assets(): array
13
    {
14
        return  [
15
            [
16
                'name' => 'Timeline',
17
                'active' => true,
18
                'files' => [
19
                    [
20
                        'type' => 'js',
21
                        'active' => true,
22
                        'location' => 'adminetic/assets/js/timeline/timeline-v-1/main.js',
23
                    ],
24
                    [
25
                        'type' => 'js',
26
                        'active' => true,
27
                        'location' => 'adminetic/assets/js/modernizr.js',
28
                    ],
29
                ],
30
            ],
31
        ];
32
    }
33
34
    public function myMenu(): array
35
    {
36
        return  [
37
            [
38
                'type' => 'menu',
39
                'name' => 'Announcement',
40
                'icon' => 'fa fa-bullhorn',
41
                'is_active' => request()->routeIs('announcement*') ? 'active' : '',
42
                'pill' => [
43
                    'class' => 'badge badge-info badge-air-info',
44
                    'value' => 'plugin',
45
                ],
46
                'conditions' => [
47
                    [
48
                        'type' => 'or',
49
                        'condition' => auth()->user()->can('view-any', Announcement::class),
50
                    ],
51
                    [
52
                        'type' => 'or',
53
                        'condition' => auth()->user()->can('create', Announcement::class),
54
                    ],
55
                ],
56
                'children' => array_merge(
57
                    [[
58
                        'type' => 'submenu',
59
                        'name' => 'Timeline',
60
                        'is_active' => request()->routeIs('timeline') ? 'active' : '',
61
                        'link' => adminRedirectRoute('timeline'),
0 ignored issues
show
The function adminRedirectRoute was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

61
                        'link' => /** @scrutinizer ignore-call */ adminRedirectRoute('timeline'),
Loading history...
62
                        'conditions' => [
63
                            [
64
                                'type' => 'or',
65
                                'condition' => auth()->user()->can('view-any', Announcement::class),
66
                            ],
67
                        ],
68
                    ]],
69
                    $this->indexCreateChildren('announcement', Announcement::class)
70
                ),
71
            ],
72
        ];
73
    }
74
75
    public function headerComponents(): array
76
    {
77
        return [
78
            '<x-announcement-announcement-notification-bell />',
79
        ];
80
    }
81
}
82