mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Use the form request on the UI controller
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
065a47a446
commit
d4c080c7e4
|
@ -343,39 +343,6 @@ class UsersController extends Controller
|
|||
|
||||
|
||||
if ($user) {
|
||||
// Check if we are not trying to delete ourselves
|
||||
if ($user->id === Auth::id()) {
|
||||
// Redirect to the user management page
|
||||
return redirect()->route('users.index')
|
||||
->with('error', trans('admin/users/message.error.cannot_delete_yourself'));
|
||||
}
|
||||
|
||||
if (($user->assets()) && ($user->assets()->count() > 0)) {
|
||||
// Redirect to the user management page
|
||||
return redirect()->route('users.index')
|
||||
->with('error', trans_choice('admin/users/message.error.delete_has_assets_var', $user->assets()->count(), ['count'=> $user->assets()->count()]));
|
||||
}
|
||||
|
||||
if (($user->licenses()) && ($user->licenses()->count() > 0)) {
|
||||
return redirect()->route('users.index')->with('error', trans_choice('admin/users/message.error.delete_has_licenses_var', $user->licenses()->count(), ['count'=> $user->licenses()->count()]));
|
||||
}
|
||||
|
||||
if (($user->accessories()) && ($user->accessories()->count() > 0)) {
|
||||
// Redirect to the user management page
|
||||
return redirect()->route('users.index')->with('error', trans_choice('admin/users/message.error.delete_has_accessories_var', $user->accessories()->count(), ['count'=> $user->accessories()->count()]));
|
||||
}
|
||||
|
||||
if (($user->managedLocations()) && ($user->managedLocations()->count() > 0)) {
|
||||
// Redirect to the user management page
|
||||
return redirect()->route('users.index')
|
||||
->with('error', trans_choice('admin/users/message.error.delete_has_locations_var', $user->managedLocations()->count(), ['count'=> $user->managedLocations()->count()]));
|
||||
}
|
||||
|
||||
if (($user->managesUsers()) && ($user->managesUsers()->count() > 0)) {
|
||||
return redirect()->route('users.index')
|
||||
->with('error', trans_choice('admin/users/message.error.delete_has_users_var', $user->managesUsers()->count(), ['count'=> $user->managesUsers()->count()]));
|
||||
}
|
||||
|
||||
// Delete the user
|
||||
$user->delete();
|
||||
return redirect()->route('users.index')->with('success', trans('admin/users/message.success.delete'));
|
||||
|
|
Loading…
Reference in a new issue