當前位置: 首頁>>代碼示例>>PHP>>正文


PHP User::delete方法代碼示例

本文整理匯總了PHP中app\User::delete方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::delete方法的具體用法?PHP User::delete怎麽用?PHP User::delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\User的用法示例。


在下文中一共展示了User::delete方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: destroyUser

 public function destroyUser(User $user, Request $request)
 {
     $name = $user->fullname();
     $user->delete();
     Flash::danger("<strong>{$name}</strong> wurde gelöscht.");
     return redirect()->back();
 }
開發者ID:patrikkernke,項目名稱:basecamp,代碼行數:7,代碼來源:TeamController.php

示例2: destroy

 public function destroy(User $user)
 {
     $name = $user->name;
     $user->delete();
     session()->flash('message', $name . "同學已經被移除");
     return Redirect::back();
 }
開發者ID:rossli,項目名稱:StuGradeWithLaravel5,代碼行數:7,代碼來源:AdminController.php

示例3: delete_user_role

 private function delete_user_role(User $user, Role $role)
 {
     //Remove all permissions then delete the user and the roles
     $role->perms()->sync(array());
     $user->delete();
     $role->delete();
 }
開發者ID:brucewu16899,項目名稱:WebPanel-Core,代碼行數:7,代碼來源:PermissionsTest.php

示例4: destroy

 public function destroy(User $user)
 {
     if ($user == auth()->user()) {
         return "Feriştahın gelse silemez beni!";
     }
     $user->delete();
     return redirect()->route('admin.user.index')->with("success", trans("realestateadmin::user.deleted"));
 }
開發者ID:labkod,項目名稱:real-estate,代碼行數:8,代碼來源:UserController.php

示例5: destroy

 public function destroy(User $user)
 {
     $name = $user->name;
     $user->delete();
     session()->flash('message', $name . "人員已經被移除");
     EventController::SaveEvent('users', 'destroy(刪除)');
     return Redirect::back();
 }
開發者ID:purplebleed,項目名稱:hljtnbdm,代碼行數:8,代碼來源:AdminController.php

示例6: destroy

 public function destroy(User $user)
 {
     try {
         $user->delete();
         return response()->json(['errors' => 'false', 'message' => 'The project has been deleted!']);
     } catch (\Exception $e) {
         return response()->json(['errors' => 'true', 'message' => 'Something went wrong!']);
     }
 }
開發者ID:jasonraimondi,項目名稱:twitterclone,代碼行數:9,代碼來源:UserController.php

示例7: destroy

 public function destroy(User $user)
 {
     if (Storage::disk('profile')->exists($user->photo) && Storage::disk('cover')->exists($user->cover)) {
         Storage::disk('profile')->delete($user->photo);
         Storage::disk('cover')->delete($user->cover);
     }
     $user->delete();
     return redirect()->route('admin.user.index')->with('success', 'کاربر با موفقیت حذف شد.');
 }
開發者ID:majid-n,項目名稱:cometdev,代碼行數:9,代碼來源:UserController.php

示例8: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(User $user)
 {
     var_dump($user->id);
     var_dump(Auth::user()->id);
     if (Auth::user()->id != $user->id) {
         $user->delete();
         return Redirect::route('users.index')->with('message', 'User deleted');
     }
     return Redirect::route('users.index')->with('message', 'You cannot delete the user that you are currently logged in as');
 }
開發者ID:redcatthethird,項目名稱:garage-manager,代碼行數:16,代碼來源:UserController.php

示例9: deleteUser

 /**
  * Delete a user
  */
 public function deleteUser(Request $request, User $user)
 {
     if (auth()->user()->id == $user->id) {
         flash()->error('You can not delete yourself', 'Have some self respect.');
         return redirect()->back();
     }
     logThis('User ' . $user->name . ' was deleted by ' . auth()->user()->name);
     flash()->success('Success!', 'User ' . $user->name . ' was deleted.');
     $user->delete();
     return redirect()->back();
 }
開發者ID:goatatwork,項目名稱:goldaccess-support,代碼行數:14,代碼來源:AdminController.php

示例10: destroy

 /**
  * Remove the specified user from storage.
  *
  * @param User $user
  * @return Response
  */
 public function destroy(User $user)
 {
     if ($user->id != Auth::user()->id) {
         $user->delete() ? Flash::success(trans('admin.delete.success')) : Flash::error(trans('admin.delete.fail'));
     } else {
         Flash::error(trans('admin.delete.self'));
     }
     return redirect(route('admin.user.index'));
 }
開發者ID:amanullah-1,項目名稱:laravel-5-simple-cms,代碼行數:15,代碼來源:UserController.php

示例11: destroy

 public function destroy(User $user)
 {
     $user->delete();
     return redirect('/');
 }
開發者ID:michaelkimball,項目名稱:MigraineTracker,代碼行數:5,代碼來源:UserController.php

示例12: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy(Request $request, User $user)
 {
     $user->delete();
     if ($request->ajax() || $request->wantsJson()) {
         return new JsonResponse($user);
     }
     return redirect('users');
 }
開發者ID:vergidul,項目名稱:personal_project,代碼行數:14,代碼來源:UsersController.php

示例13: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy(User $user)
 {
     if (!$user->remove) {
         \Flash::error('Default user cannot be removed.');
         return redirect()->route('admin.users.index');
     } else {
         $user->delete();
         \Flash::success('User has been Deleted');
         return redirect()->route('admin.users.index');
     }
 }
開發者ID:maherelgamil,項目名稱:ketabat,代碼行數:17,代碼來源:UsersController.php

示例14: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param $user
  * @return Response
  */
 public function destroy(User $user)
 {
     $user->delete();
 }
開發者ID:coralhust,項目名稱:Laravel-5-Bootstrap-3-Starter-Site,代碼行數:10,代碼來源:UserController.php

示例15: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(Request $request, City $city, User $user)
 {
     $user_events = Event::where('user_id', '=', $user->id)->delete();
     $user->delete();
     return Redirect::route('{city}.users.index', $city->iata)->with('message', 'User removed');
 }
開發者ID:EMT,項目名稱:see-do,代碼行數:12,代碼來源:UsersController.php


注:本文中的app\User::delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。