I get this error after I have installed the code and enter the page :
ErrorException
Illegal offset type in isset or empty (View: modules\Location\Views\frontend\blocks\list-locations\loop.blade.php)
The line that its shows the error on is:
Illuminate\Foundation\Bootstrap\HandleExceptions::handleError modules\Location\Models\Location.php:62
Code:
public function getDisplayNumberServiceInLocation($service_type)
{
$allServices = get_bookable_services();
if (empty($allServices[$service_type]))
return false;
$module = new $allServices[$service_type];
return $module->getNumberServiceInLocation($this);
}
::require modules/Location/Views/frontend/blocks/list-locations/loop.blade.php:7
Code:
$translation = $row->translateOrOrigin(app()->getLocale());
$link_location = false;
if (is_string($service_type)) {
$link_location = $row->getLinkForPageSearch($service_type);
}
I can't find any solution for the error.
Instead of using empty()
you can use !isset()
function. Your code should be:
public function getDisplayNumberServiceInLocation($service_type)
{
$allServices = get_bookable_services();
if(!isset($allServices[$service_type])) return false;
$module = new $allServices[$service_type];
return $module->getNumberServiceInLocation($this);
}