mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -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'));
|
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'));
|
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'));
|
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'));
|
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'));
|
return redirect()->to(route('locations.index'))->with('error', trans('admin/locations/message.assoc_assets'));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue