CustomerMenu.php
1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
namespace App\Http\Middleware;
use App\Events\CustomerMenuCreated;
use Auth;
use Closure;
use Menu;
class CustomerMenu
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
// Check if logged in
if (!Auth::check()) {
return $next($request);
}
Menu::create('CustomerMenu', function ($menu) {
$menu->style('adminlte');
$user = Auth::user();
// Dashboard
$menu->add([
'url' => 'customers/',
'title' => trans('general.dashboard'),
'icon' => 'fa fa-dashboard',
'order' => 1,
]);
// Invoices
$menu->add([
'url' => 'customers/invoices',
'title' => trans_choice('general.invoices', 2),
'icon' => 'fa fa-wpforms',
'order' => 2,
]);
// Payments
$menu->add([
'url' => 'customers/payments',
'title' => trans_choice('general.payments', 2),
'icon' => 'fa fa-money',
'order' => 3,
]);
// Payments
$menu->add([
'url' => 'customers/transactions',
'title' => trans_choice('general.transactions', 2),
'icon' => 'fa fa-list',
'order' => 4,
]);
// Fire the event to extend the menu
event(new CustomerMenuCreated($menu));
});
return $next($request);
}
}