当前位置: 首页>>代码示例>>PHP>>正文


PHP User::destroy方法代码示例

本文整理汇总了PHP中app\User::destroy方法的典型用法代码示例。如果您正苦于以下问题:PHP User::destroy方法的具体用法?PHP User::destroy怎么用?PHP User::destroy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\User的用法示例。


在下文中一共展示了User::destroy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  \App\Http\Requests\UserDestroyRequest  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(UserDestroyRequest $request, $id)
 {
     $user = $this->user->find($id);
     $this->user->destroy($id);
     event(new UserDestroyBroadcastEvent($user->toArray()));
     return response($user);
 }
开发者ID:xzxzyzyz,项目名称:laravel-websocket-sample,代码行数:14,代码来源:UserController.php

示例2: deleteContact

 public function deleteContact(Request $request)
 {
     $idContact = $request->idContact;
     $deletedRows = Contact::where('user_id', $idContact)->delete();
     $user = User::destroy($idContact);
     return redirect('/');
 }
开发者ID:dgalifi,项目名称:mosaicoon_test,代码行数:7,代码来源:ContactsController.php

示例3: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $listIds = explode(",", $id);
     foreach ($listIds as $item) {
         $this->user->destroy($item);
     }
     return response()->json(['result' => 'Success'], 200);
 }
开发者ID:psgganesh,项目名称:sparkplug,代码行数:14,代码来源:UsersController.php

示例4: destroy

 public function destroy(Request $request, $id)
 {
     if (count(\App\User::find($id)) == 0) {
         return $request->ajax() ? 'User does not exist!' : redirect()->route('list.user');
     }
     \App\User::destroy($id);
     return redirect()->route('list.user')->with(['msg' => 'Delete user success!']);
 }
开发者ID:phumaster,项目名称:quan_ly_hoc_tap,代码行数:8,代码来源:User.php

示例5: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     if (User::destroy($id)) {
         return "User deleted successfully.";
     } else {
         return $this->response->error('User does not exist.', 404);
     }
 }
开发者ID:sax69sax,项目名称:task-manager-api,代码行数:14,代码来源:UserController.php

示例6: destroy

 public function destroy($id = 0)
 {
     $id = intval($id);
     if ($id == 1) {
         return ['error' => 1, 'message' => '初始账号无法删除!'];
     }
     User::destroy($id);
     return ['error' => 0, 'message' => '删除成功!'];
 }
开发者ID:lakche,项目名称:timeCMS-free,代码行数:9,代码来源:UsersController.php

示例7: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(Request $request)
 {
     if (Request::isMethod('get')) {
         $users = User::orderBy('id', 'desc')->paginate(50);
         return view('admin.users.list', array('users' => $users));
     }
     $idUser = Request::input('data');
     User::destroy($idUser);
 }
开发者ID:namcoder,项目名称:Topshare,代码行数:14,代码来源:UserController.php

示例8: delete

 public function delete()
 {
     $usr_id = Auth::user()->id;
     if (User::destroy($usr_id)) {
         Thread::where('user_id', '=', $usr_id)->delete();
         Relation::where('user_id', '=', $usr_id)->delete();
         Comment::where('user_id', '=', $usr_id)->delete();
     }
 }
开发者ID:ziracmo,项目名称:Projet-transversal-2,代码行数:9,代码来源:UserController.php

示例9: destroy

 public function destroy(Request $request, $id)
 {
     if ($id) {
         User::destroy($id);
         Session::flash('flash_message', 'User has been deleted successfully.');
         Session::flash('flash_type', 'alert-success');
     }
     return redirect('admin/users');
 }
开发者ID:ramant15,项目名称:ektimo,代码行数:9,代码来源:UsersController.php

示例10: deleteUsers

 public function deleteUsers(Request $request)
 {
     $result = User::destroy($request->input('id'));
     if ($result) {
         return Session::flash('message', 'My message');
     } else {
         return Session::flash('message', 'My message1');
     }
 }
开发者ID:slopcri,项目名称:Laravel_Local,代码行数:9,代码来源:UserController.php

示例11: destroy

 /**
  * Delete the user from the database
  *
  * @param $id
  * @return \Illuminate\Http\JsonResponse
  */
 public function destroy($id)
 {
     if (\Auth::user()->id == $id) {
         return response()->json(['message' => 'Please don\'t delete yourself.'], 403);
     }
     if (User::destroy($id)) {
         return response()->json(['message' => 'User deleted.'], 201);
     }
     return response()->json(['message' => 'Can\'t process request.'], 403);
 }
开发者ID:ljiriko,项目名称:hp_test1,代码行数:16,代码来源:UsersController.php

示例12: destroy

 function destroy()
 {
     $destroy = User::destroy(Input::get("id"));
     if ($destroy) {
         $_SESSION['delete'] = '<p style="color:green;">Doktor Başarıyla Silindi.</p>';
     } else {
         $_SESSION['delete'] = '<p style="color:red;">Doktor Silinemedi.</p>';
     }
     return Redirect::to('./doktorlar');
 }
开发者ID:ufukpalavar52,项目名称:laravel-php-projelerim,代码行数:10,代码来源:UsersController.php

示例13: destroy

 public function destroy()
 {
     $user = JWTAuth::parseToken()->authenticate();
     if ($user) {
         User::destroy($user->id);
         return response('Success');
     } else {
         return response('Unathorized', 403);
     }
 }
开发者ID:mkhrystunov,项目名称:laravel_test,代码行数:10,代码来源:UserController.php

示例14: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  string  $id
  * @return Response
  */
 public function destroy($id)
 {
     try {
         User::destroy($id);
         session()->flash('success', 'Member is successfully deleted.');
     } catch (\Exception $e) {
         session()->flash('error', 'Error occured to delete member.');
     }
     return back();
 }
开发者ID:GreenHackers,项目名称:election-website,代码行数:16,代码来源:MemberController.php

示例15: deleteUser

 public function deleteUser($user_id)
 {
     $user = \App\User::findOrFail($user_id);
     if (!$user->recipes->isEmpty()) {
         foreach ($user->recipes as $recipe) {
             \App\Recipe::destroy($recipe->id);
         }
         \App\User::destroy($user_id);
     } else {
         \App\User::destroy($user_id);
     }
     return redirect()->route('admin');
 }
开发者ID:shadaki85,项目名称:laravel_ricettario,代码行数:13,代码来源:RicetteController.php


注:本文中的app\User::destroy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。