public function detailUser($id) { $title = 'detail User'; $role = Role::whereHas('users', function ($q) use($id) { $q->where('id', $id); })->get(); $user = User::GetUser($id)->get(); //dd($role[0]->name); //dd($user[0]); return view('Users.detail_user', ['title' => $title, 'role_name' => $role[0]->name, 'user' => $user[0]]); }