|
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\Contracts\Module\Navigable; |
|
13
|
|
|
use Terranet\Administrator\Dashboard\Manager; |
|
14
|
|
|
use Terranet\Administrator\Dashboard\Row; |
|
15
|
|
|
|
|
16
|
|
|
class AdminServiceProvider extends ServiceProvider |
|
17
|
|
|
{ |
|
18
|
|
|
/** |
|
19
|
|
|
* Dashboard panels registration. |
|
20
|
|
|
* |
|
21
|
|
|
* @param Manager $dashboard |
|
22
|
|
|
* @return Manager |
|
23
|
|
|
*/ |
|
24
|
|
|
protected function dashboard(Manager $dashboard) |
|
25
|
|
|
{ |
|
26
|
|
|
return $dashboard |
|
27
|
|
|
->row(function (Row $row) { |
|
28
|
|
|
$row->panel(new BlankPanel)->setWidth(12); |
|
29
|
|
|
}) |
|
30
|
|
|
->row(function (Row $row) { |
|
31
|
|
|
$row->panel(new MembersPanel)->setWidth(6); |
|
32
|
|
|
$row->panel(new DatabasePanel)->setWidth(6); |
|
33
|
|
|
}); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @param Menu $navigation |
|
38
|
|
|
*/ |
|
39
|
|
|
protected function navigation(Menu $navigation) |
|
40
|
|
|
{ |
|
41
|
|
|
$navigation->create(Navigable::MENU_SIDEBAR, function (MenuBuilder $sidebar) { |
|
42
|
|
|
// Dashboard |
|
43
|
|
|
$sidebar->route('scaffold.dashboard', trans('administrator::module.dashboard'), [], 1, [ |
|
44
|
|
|
'id' => 'dashboard', |
|
45
|
|
|
'icon' => 'fa fa-home', |
|
46
|
|
|
'active' => str_is(request()->route()->getName(), 'scaffold.dashboard'), |
|
47
|
|
|
]); |
|
48
|
|
|
|
|
49
|
|
|
// Create "resources" group |
|
50
|
|
|
$sidebar->dropdown(trans('administrator::module.groups.resources'), function (MenuItem $sub) { |
|
|
|
|
|
|
51
|
|
|
}, 2, ['id' => 'groups', 'icon' => 'fa fa-qrcode']); |
|
52
|
|
|
}); |
|
53
|
|
|
|
|
54
|
|
|
$navigation->create(Navigable::MENU_TOOLS, function (MenuBuilder $tools) { |
|
55
|
|
|
if (app('scaffold.config')->get('file_manager')) { |
|
56
|
|
|
$tools->url( |
|
57
|
|
|
route('scaffold.media'), |
|
58
|
|
|
trans('administrator::buttons.media'), |
|
59
|
|
|
98, |
|
60
|
|
|
['icon' => 'fa fa-file-text-o'] |
|
61
|
|
|
); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
if (app('scaffold.config')->get('translations.enabled')) { |
|
65
|
|
|
$tools->url( |
|
66
|
|
|
route('scaffold.translations.index'), |
|
67
|
|
|
trans('administrator::buttons.translations'), |
|
68
|
|
|
99, |
|
69
|
|
|
['icon' => 'fa fa-globe'] |
|
70
|
|
|
); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
$tools->url( |
|
74
|
|
|
route('scaffold.logout'), |
|
75
|
|
|
trans('administrator::buttons.logout'), |
|
76
|
|
|
100, |
|
77
|
|
|
['icon' => 'fa fa-mail-forward'] |
|
78
|
|
|
); |
|
79
|
|
|
}); |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* Register services. |
|
84
|
|
|
* |
|
85
|
|
|
* @return void |
|
86
|
|
|
*/ |
|
87
|
|
|
public function register() |
|
88
|
|
|
{ |
|
89
|
|
|
$this->app->singleton('scaffold.dashboard', function () { |
|
90
|
|
|
return $this->dashboard(new Manager()); |
|
91
|
|
|
}); |
|
92
|
|
|
} |
|
93
|
|
|
} |
|
94
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.