Fixed some missing strings and checks
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
@@ -346,33 +346,35 @@ class UsersController extends Controller
|
||||
if ($user->id === Auth::id()) {
|
||||
// Redirect to the user management page
|
||||
return redirect()->route('users.index')
|
||||
->with('error', 'We would feel really bad if you deleted yourself, please reconsider.');
|
||||
->with('error', trans('admin/users/message.error.cannot_delete_yourself'));
|
||||
}
|
||||
|
||||
if (($user->assets()) && (($assetsCount = $user->assets()->count()) > 0)) {
|
||||
if (($user->assets()) && ($user->assets()->count() > 0)) {
|
||||
// Redirect to the user management page
|
||||
return redirect()->route('users.index')
|
||||
->with('error', 'This user still has '.$assetsCount.' assets associated with them.');
|
||||
->with('error', trans_choice('admin/users/message.error.delete_has_assets_var', $user->assets()->count(), ['count'=> $user->assets()->count()]));
|
||||
}
|
||||
|
||||
if (($user->licenses()) && (($licensesCount = $user->licenses()->count())) > 0) {
|
||||
// Redirect to the user management page
|
||||
return redirect()->route('users.index')
|
||||
->with('error', 'This user still has '.$licensesCount.' licenses associated with them.');
|
||||
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()) && (($accessoriesCount = $user->accessories()->count()) > 0)) {
|
||||
if (($user->accessories()) && ($user->accessories()->count() > 0)) {
|
||||
// Redirect to the user management page
|
||||
return redirect()->route('users.index')
|
||||
->with('error', 'This user still has '.$accessoriesCount.' accessories associated with them.');
|
||||
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()) && (($managedLocationsCount = $user->managedLocations()->count())) > 0) {
|
||||
if (($user->managedLocations()) && ($user->managedLocations()->count() > 0)) {
|
||||
// Redirect to the user management page
|
||||
return redirect()->route('users.index')
|
||||
->with('error', 'This user still has '.$managedLocationsCount.' locations that they manage.');
|
||||
->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'));
|
||||
|
||||
Reference in New Issue
Block a user