本文整理汇总了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();
}
示例2: destroy
public function destroy(User $user)
{
$name = $user->name;
$user->delete();
session()->flash('message', $name . "同学已经被移除");
return Redirect::back();
}
示例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();
}
示例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"));
}
示例5: destroy
public function destroy(User $user)
{
$name = $user->name;
$user->delete();
session()->flash('message', $name . "人员已经被移除");
EventController::SaveEvent('users', 'destroy(删除)');
return Redirect::back();
}
示例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!']);
}
}
示例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', 'کاربر با موفقیت حذف شد.');
}
示例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');
}
示例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();
}
示例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'));
}
示例11: destroy
public function destroy(User $user)
{
$user->delete();
return redirect('/');
}
示例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');
}
示例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');
}
}
示例14: destroy
/**
* Remove the specified resource from storage.
*
* @param $user
* @return Response
*/
public function destroy(User $user)
{
$user->delete();
}
示例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');
}