mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -08:00
Fixed Call to a member function count() on null for location delete
This commit is contained in:
parent
a8bbb951bc
commit
a5b180a9c6
|
@ -199,16 +199,16 @@ class LocationsController extends Controller
|
|||
return redirect()->to(route('locations.index'))->with('error', trans('admin/locations/message.not_found'));
|
||||
}
|
||||
|
||||
if ($location->users()->count() > 0) {
|
||||
if (($location->users()) && ($location->users()->count() > 0)) {
|
||||
return redirect()->to(route('locations.index'))->with('error', trans('admin/locations/message.assoc_users'));
|
||||
|
||||
} elseif ($location->children->count() > 0) {
|
||||
} elseif (($location->children) && ($location->children->count() > 0)) {
|
||||
return redirect()->to(route('locations.index'))->with('error', trans('admin/locations/message.assoc_child_loc'));
|
||||
|
||||
} elseif ($location->assets()->count() > 0) {
|
||||
} elseif (($location->assets()) && ($location->assets()->count() > 0)) {
|
||||
return redirect()->to(route('locations.index'))->with('error', trans('admin/locations/message.assoc_assets'));
|
||||
|
||||
} elseif ($location->assignedassets()->count() > 0) {
|
||||
} elseif (($location->assignedassets()) && ($location->assignedassets()->count() > 0)) {
|
||||
return redirect()->to(route('locations.index'))->with('error', trans('admin/locations/message.assoc_assets'));
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue