Nenhuma Descrição

IndexController.php 842B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * Created by Sublime.
  4. * User: Williamslife Wang
  5. * Date: 17/10/18
  6. * Time: 上午11:20
  7. */
  8. namespace App\Http\Controllers\Admin;
  9. use App\Http\Controllers\Controller;
  10. use App\Role;
  11. use App\AdminRole;
  12. // use App\ProductChannel;
  13. // use App\Logs;
  14. use Illuminate\Support\Facades\DB;
  15. class IndexController extends Controller
  16. {
  17. public function index()
  18. {
  19. $name = session("username");
  20. $admin_id = session("admin_id");
  21. $role = AdminRole::where('user_id', '=', $admin_id)->get();
  22. $res = [];
  23. foreach($role as $v){
  24. $roles = Role::where('name', '=', $v['role_name'])->get();
  25. foreach($roles as $vv){
  26. $res[$vv['child']] = $vv['child'];
  27. }
  28. }
  29. $res = array_unique($res);
  30. return view('admin/index',['res'=>$res]);
  31. }
  32. }