本文整理汇总了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);
}
示例2: deleteContact
public function deleteContact(Request $request)
{
$idContact = $request->idContact;
$deletedRows = Contact::where('user_id', $idContact)->delete();
$user = User::destroy($idContact);
return redirect('/');
}
示例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);
}
示例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!']);
}
示例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);
}
}
示例6: destroy
public function destroy($id = 0)
{
$id = intval($id);
if ($id == 1) {
return ['error' => 1, 'message' => '初始账号无法删除!'];
}
User::destroy($id);
return ['error' => 0, 'message' => '删除成功!'];
}
示例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);
}
示例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();
}
}
示例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');
}
示例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');
}
}
示例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);
}
示例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');
}
示例13: destroy
public function destroy()
{
$user = JWTAuth::parseToken()->authenticate();
if ($user) {
User::destroy($user->id);
return response('Success');
} else {
return response('Unathorized', 403);
}
}
示例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();
}
示例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');
}