|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace App\Http\Controllers; |
|
4
|
|
|
|
|
5
|
|
|
use App\Repository\Admin\MenuRepository; |
|
6
|
|
|
use Illuminate\Foundation\Bus\DispatchesJobs; |
|
7
|
|
|
use Illuminate\Routing\Controller as BaseController; |
|
8
|
|
|
use Illuminate\Foundation\Validation\ValidatesRequests; |
|
9
|
|
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests; |
|
10
|
|
|
use Illuminate\Support\Facades\View; |
|
11
|
|
|
use App\Repository\Admin\EntityRepository; |
|
12
|
|
|
|
|
13
|
|
|
class Controller extends BaseController |
|
14
|
|
|
{ |
|
15
|
|
|
use AuthorizesRequests, DispatchesJobs, ValidatesRequests; |
|
16
|
|
|
|
|
17
|
|
|
protected $breadcrumb = []; |
|
18
|
|
|
|
|
19
|
|
|
protected $formNames = []; |
|
20
|
|
|
|
|
21
|
|
|
public function __construct() |
|
22
|
|
|
{ |
|
23
|
|
|
if (request()->ajax()) { |
|
24
|
|
|
return; |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
// 面包屑导航 |
|
28
|
|
|
$this->breadcrumb[] = ['title' => '首页', 'url' => route('admin::index')]; |
|
29
|
|
|
View::share('breadcrumb', $this->breadcrumb); |
|
30
|
|
|
|
|
31
|
|
|
|
|
32
|
|
|
// 菜单 |
|
33
|
|
|
$route = request()->route(); |
|
34
|
|
|
if (is_null($route)) { |
|
35
|
|
|
return; |
|
36
|
|
|
} |
|
37
|
|
|
$route = request()->route()->getName(); |
|
38
|
|
|
View::share('light_cur_route', $route); |
|
39
|
|
|
if (is_null($currentRootMenu = MenuRepository::root($route))) { |
|
40
|
|
|
View::share('light_menu', []); |
|
41
|
|
|
} else { |
|
42
|
|
|
View::share('light_menu', $currentRootMenu); |
|
43
|
|
|
if ($route !== 'admin::aggregation' && $currentRootMenu['route'] === 'admin::aggregation') { |
|
44
|
|
|
View::share('autoMenu', EntityRepository::systemMenu()); |
|
45
|
|
|
} |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
$this->formNames = array_merge($this->formNames, ['created_at']); |
|
49
|
|
|
} |
|
50
|
|
|
} |
|
51
|
|
|
|