/**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     // Start Check Authorization
     $invalid_auth = 1;
     $authRole = Auth::user()->UserRoles->role;
     if ($authRole == 1 or $authRole == 3 or $authRole == 5 or $authRole == 7 or $authRole == 9) {
         $invalid_auth = 0;
     }
     if ($invalid_auth == 1) {
         Alert::error('Anda tidak memilik akses ini')->persistent('close');
         return redirect('dashboard');
     }
     // End Check Authorization
     $data = User::find($id);
     $data->name = $request->input('name');
     $data->email = $request->input('email');
     $data->save();
     $da = UserRoles::find($request->input('id_roles'));
     $da->role = $request->input('role');
     $da->save();
     Alert::success('Perbaharui User');
     return redirect('user');
 }
Beispiel #2
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $user_roles = UserRoles::lists('user_role_name', 'id')->toArray();
     $projects = $this->projectRepository->getAllProjects()->lists('name', 'id');
     return view('user.create', compact('user_roles', 'projects'));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $item = UserRoles::find($id);
     $item->status = 'deleted';
     $item->save();
     Log::create(array("user_id" => Auth::user()->id, "action" => "Delete User Role named " . $item->name));
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $data = User::find($id);
     $data->name = $request->input('name');
     $data->email = $request->input('email');
     $data->save();
     $da = UserRoles::find($request->input('id_roles'));
     $da->role = $request->input('role');
     $da->save();
     Alert::success('Perbaharui User');
     return redirect('user');
 }