|
@@ -9,6 +9,7 @@ namespace App\Http\Controllers\Admin;
|
9
|
9
|
|
10
|
10
|
use App\Http\Controllers\Controller;
|
11
|
11
|
use App\Role;
|
|
12
|
+ use App\AdminRole;
|
12
|
13
|
// use App\ProductChannel;
|
13
|
14
|
// use App\Logs;
|
14
|
15
|
use Illuminate\Support\Facades\DB;
|
|
@@ -19,7 +20,16 @@ class IndexController extends Controller
|
19
|
20
|
public function index()
|
20
|
21
|
{
|
21
|
22
|
$name = session("username");
|
22
|
|
- $res = Role::where('name',$name)->lists('child');
|
|
23
|
+ $admin_id = session("admin_id");
|
|
24
|
+ $role = AdminRole::where('user_id', '=', $admin_id)->get();
|
|
25
|
+ $res = [];
|
|
26
|
+ foreach($role as $v){
|
|
27
|
+ $roles = Role::where('name', '=', $v['role_name'])->get();
|
|
28
|
+ foreach($roles as $vv){
|
|
29
|
+ $res[$vv['child']] = $vv['child'];
|
|
30
|
+ }
|
|
31
|
+ }
|
|
32
|
+ $res = array_unique($res);
|
23
|
33
|
return view('admin/index',['res'=>$res]);
|
24
|
34
|
}
|
25
|
35
|
}
|