예제 #1
0
 /**
  * Delete a single user
  * @param  User    $user an ijnect instance of the user model
  * @return \Illuminate\Support\Facades\Redirect        redirect to the users index page with a flash message
  */
 public function delete(User $user)
 {
     // we make the user with id 1 undeletable
     if ($user->id == 1 || $user->type != 'admin') {
         return redirect()->route('users.index')->with('warning', trans('users::users.user_undeletable'));
     }
     // we delete the user
     $user->delete();
     // redirect to the users index
     return redirect()->route('users.index')->with('success', trans('users::users.delete_success'));
 }