laravel After php artisan migrate:在isset或empty中存在非法的偏移类型

0sgqnhkj  于 2023-11-20  发布在  PHP
关注(0)|答案(1)|浏览(146)

我得到这个错误后,我已经安装了代码,并进入页面:
Error(View:modules\Location\Views\frontend\blocks\list-locations\loop.blade.php)
显示错误的行是:

Illuminate\Foundation\Bootstrap\Handlebar::Error modules\Location\Models\Location.php:62

代码:

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

验证码:

$translation = $row->translateOrOrigin(app()->getLocale());

    $link_location = false;

    if(is_string($service_type)){

        $link_location = $row->getLinkForPageSearch($service_type);

    }


我不能解决这个错误.

xtfmy6hx

xtfmy6hx1#

你可以使用!isset()函数来代替empty()。你的代码应该是:

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);

        }

字符串

相关问题