1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Providers; |
4
|
|
|
|
5
|
|
|
use App\Http\Terranet\Administrator\Dashboard\BlankPanel; |
6
|
|
|
use App\Http\Terranet\Administrator\Dashboard\DatabasePanel; |
7
|
|
|
use App\Http\Terranet\Administrator\Dashboard\MembersPanel; |
8
|
|
|
use Illuminate\Support\ServiceProvider; |
9
|
|
|
use Pingpong\Menus\Menu; |
10
|
|
|
use Pingpong\Menus\MenuBuilder; |
11
|
|
|
use Pingpong\Menus\MenuItem; |
12
|
|
|
use Terranet\Administrator\Architect; |
13
|
|
|
use Terranet\Administrator\Contracts\Module\Navigable; |
14
|
|
|
use Terranet\Administrator\Dashboard\Manager; |
15
|
|
|
use Terranet\Administrator\Dashboard\Row; |
16
|
|
|
use Terranet\Options\Manager as OptionsManager; |
|
|
|
|
17
|
|
|
|
18
|
|
|
class AdminServiceProvider extends ServiceProvider |
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* Dashboard panels registration. |
22
|
|
|
* |
23
|
|
|
* @param Manager $dashboard |
24
|
|
|
* @return Manager |
25
|
|
|
*/ |
26
|
|
|
protected function dashboard(Manager $dashboard) |
27
|
|
|
{ |
28
|
|
|
return $dashboard |
29
|
|
|
->row(function (Row $row) { |
30
|
|
|
$row->panel(new BlankPanel)->setWidth(12); |
31
|
|
|
}) |
32
|
|
|
->row(function (Row $row) { |
33
|
|
|
$row->panel(new MembersPanel)->setWidth(6); |
34
|
|
|
$row->panel(new DatabasePanel)->setWidth(6); |
35
|
|
|
}); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @param Menu $navigation |
40
|
|
|
* @return Menu |
41
|
|
|
*/ |
42
|
|
|
protected function navigation(Menu $navigation) |
43
|
|
|
{ |
44
|
|
|
$navigation->create(Navigable::MENU_SIDEBAR, function (MenuBuilder $sidebar) { |
45
|
|
|
// Dashboard |
46
|
|
|
$sidebar->route('scaffold.dashboard', trans('administrator::module.dashboard'), [], 1, [ |
|
|
|
|
47
|
|
|
'id' => 'dashboard', |
48
|
|
|
'icon' => 'fa fa-home', |
49
|
|
|
'active' => str_is(request()->route()->getName(), 'scaffold.dashboard'), |
|
|
|
|
50
|
|
|
]); |
51
|
|
|
|
52
|
|
|
// Create "resources" group |
53
|
|
|
$sidebar->dropdown(trans('administrator::module.groups.resources'), function (MenuItem $sub) { |
|
|
|
|
54
|
|
|
}, 2, ['id' => 'groups', 'icon' => 'fa fa-qrcode']); |
55
|
|
|
}); |
56
|
|
|
|
57
|
|
|
$navigation->create(Navigable::MENU_TOOLS, function (MenuBuilder $tools) { |
58
|
|
|
if (config('administrator.file_manager.enabled')) { |
|
|
|
|
59
|
|
|
$tools->url( |
60
|
|
|
route('scaffold.media'), |
|
|
|
|
61
|
|
|
trans('administrator::buttons.media'), |
|
|
|
|
62
|
|
|
1, |
63
|
|
|
['icon' => 'fa fa-file-text-o'] |
64
|
|
|
); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
if (config('administrator.settings.enabled') && class_exists(OptionsManager::class, true)) { |
68
|
|
|
$tools->url( |
69
|
|
|
route('scaffold.settings.edit'), |
70
|
|
|
trans('administrator::module.resources.settings'), |
71
|
|
|
2, |
72
|
|
|
['icon' => 'fa fa-gears'] |
73
|
|
|
); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
if (config('administrator.translations.enabled')) { |
77
|
|
|
$tools->url( |
78
|
|
|
route('scaffold.translations.index'), |
79
|
|
|
trans('administrator::buttons.translations'), |
80
|
|
|
3, |
81
|
|
|
['icon' => 'fa fa-globe'] |
82
|
|
|
); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
$tools->url( |
86
|
|
|
route('scaffold.logout'), |
87
|
|
|
trans('administrator::buttons.logout'), |
88
|
|
|
100, |
89
|
|
|
['icon' => 'fa fa-mail-forward'] |
90
|
|
|
); |
91
|
|
|
}); |
92
|
|
|
|
93
|
|
|
return $navigation; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* Register services. |
98
|
|
|
* |
99
|
|
|
* @return void |
100
|
|
|
*/ |
101
|
|
|
public function register() |
102
|
|
|
{ |
103
|
|
|
$this->app->singleton('scaffold.dashboard', function () { |
104
|
|
|
return $this->dashboard(new Manager()); |
105
|
|
|
}); |
106
|
|
|
|
107
|
|
|
$this->app->singleton('scaffold.navigation', function ($app) { |
108
|
|
|
return $this->navigation(new Menu($app['view'], $app['config'])); |
109
|
|
|
}); |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* Bootstrap any application services. |
114
|
|
|
* |
115
|
|
|
* @return void |
116
|
|
|
*/ |
117
|
|
|
public function boot() |
118
|
|
|
{ |
119
|
|
|
$this->routes(); |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* Register AdminArchitect routes. |
124
|
|
|
*/ |
125
|
|
|
protected function routes() |
126
|
|
|
{ |
127
|
|
|
Architect::routes() |
128
|
|
|
->withAuthenticationRoutes() |
129
|
|
|
->withTranslationRoutes() |
130
|
|
|
->withMediaRoutes() |
131
|
|
|
->withSettingRoutes() |
132
|
|
|
->withExtraRoutes(function () { |
133
|
|
|
if (file_exists($path = base_path('routes/admin.php'))) { |
|
|
|
|
134
|
|
|
$this->loadRoutesFrom($path); |
135
|
|
|
} |
136
|
|
|
}); |
137
|
|
|
} |
138
|
|
|
} |
139
|
|
|
|
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