mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 13:44:06 -08:00
Fixes #4056 - check for assets before deleting user
This commit is contained in:
parent
507f1f196c
commit
51236a2ad9
|
@ -376,6 +376,11 @@ class UsersController extends Controller
|
||||||
return redirect()->route('users.index')->with('error', 'This user still has ' . $user->assets()->count() . ' assets associated with them.');
|
return redirect()->route('users.index')->with('error', 'This user still has ' . $user->assets()->count() . ' assets associated with them.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (count($user->assets) > 0) {
|
||||||
|
// Redirect to the user management page
|
||||||
|
return redirect()->route('users.index')->with('error', 'This user still has ' . count($user->assets) . ' assets associated with them.');
|
||||||
|
}
|
||||||
|
|
||||||
if ($user->licenses()->count() > 0) {
|
if ($user->licenses()->count() > 0) {
|
||||||
// Redirect to the user management page
|
// Redirect to the user management page
|
||||||
return redirect()->route('users.index')->with('error', 'This user still has ' . $user->assets()->count() . ' assets associated with them.');
|
return redirect()->route('users.index')->with('error', 'This user still has ' . $user->assets()->count() . ' assets associated with them.');
|
||||||
|
|
Loading…
Reference in a new issue