Пример #1
0
 /**
  * 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));
 }
Пример #2
0
 /**
  * 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');
 }
Пример #3
0
 /**
  * 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');
 }