目标 class [auth.shop] 不存在

Target class [auth.shop] does not exist

我正在尝试使用 Laravel 创建我的第一个 Shopify 应用程序,但我陷入了这个错误。

Illuminate\Contracts\Container\BindingResolutionException
Target class [auth.shop] does not exist.

我的web.php文件是这样的:

<?php

use Illuminate\Support\Facades\Route;

Route::get('/', function () {
    return view('welcome');
})->middleware(['auth.shop'])->name('home');

版本是

"osiset/laravel-shopify": "^17.1"

有人可以帮助我吗?

根据这个问题https://github.com/osiset/laravel-shopify/issues/503

auth.shopifyv11+ 包中间件。

如果您使用的是 v10 则其 auth.shop

根据最新版本 https://github.com/osiset/laravel-shopify/releases/tag/v17.0.0

Removal of auth.shopify middleware in-favour of verify.shopify middleware

所以你应该使用 verify.shopify 而不是 auth.shop

也根据文档https://github.com/osiset/laravel-shopify/wiki/Installation#middlewares

verify.shopify, handles authentication of the shop, verification, and session token handling for both standard requests and AJAX. auth.webhook, handles verification of webhooks and their data. auth.proxy, handles verification of proxy requests.