/** * Display a listing of the resource. * * @return Response */ public function indexORG() { #$test = new \WI\User\User(); #$test = $test->getTest(); #$users = User::all(); #$pagination = false; #return view('user::index',compact('users','pagination')); //auth()->loginUsingId(2); //$users = User::with('role','locale')->paginate(5); $users = User::with('roles', 'locale')->paginate(20); //all role names as array //dc($users[2]->roles->pluck('name')->all()); //all role names as string //dc($users[2]->roles->implode('name',',')); $pagination = $users instanceof LengthAwarePaginator; return view('user::indexORG', compact('users', 'columnNames', 'pagination')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { //auth()->loginUsingId(1); //$user = User::findOrFail($id); $user = User::with('roles')->findOrFail($id); //dc($user->isBackEndUser()); //if (\Gate::denies('editProfile',($user))){ // dc('edit denied'); //abort('401include'); //} //dc($user->roles->pluck('id')->all()); $roles = Role::lists('name', 'id'); //dc($roles); $locales = Locale::lists('name', 'id'); $companies = Company::lists('name', 'id'); $usertypes = Usertype::lists('name', 'id'); // dc($locales); return view('user::edit', compact('user', 'roles', 'locales', 'companies', 'usertypes')); }