只能用字符串实例化这个对象(Laravel)?



当我调用route时得到这个错误。我给出如下的路由:

<a href="{{ route('billing', ['plan' => $plan[0]->id]) }}">
<button style="padding:15px 25px;border:none;color:#007F5F;font-weight:700;font-size:20px;border-         radius:10px;">Choose Plan</button>
</a>

,但当我点击链接,我得到这个错误:Laravel错误图片

This is my Route:

if (Util::registerPackageRoute('billing.process', $manualRoutes)) {
Route::get(
'/billing/process/{plan?}',
BillingController::class.'@process'
)
->middleware(['verify.shopify'])
->where('plan', '^([0-9]+|)$')
->name(Util::getShopifyConfig('route_names.billing.process'));
}

我无法理解这个错误,请帮助我解决这个错误。

我通过在路由上添加shop参数来解决我的错误:

My route Now:

<a href="{{ route('billing', ['plan' => 2, 'shop' => Auth::user()->name]) }}">
<button style="padding:15px 25px;border:none;color:#007F5F;font- 
weight:700;font-size:20px;border-radius:10px;">Choose Plan</button>
</a>

此路由正常运行:😊😊😊

查看相关问题:https://github.com/gnikyt/laravel-shopify/issues/872

最新更新