在文件中找不到类"应用程序/用户"....网络钩控制器.php在线 208 拉拉维尔收银员条纹网络钩



这是我的Webhook控制器中显示错误的部分。对我来说,一切看起来都是正确的。我可能错过了什么?

此外,只有处理付款发票 webhook 有效,其他所有内容都给了我下面的 500 错误。

/**
* Get the billable entity instance by Stripe ID.
*
* @param  string|null  $stripeId
* @return LaravelCashierBillable|null
*/
protected function getUserByStripeId($stripeId)
{
if ($stripeId === null) {
return;
}
$model = config('cashier.model');
return (new $model)->where('stripe_id', $stripeId)->first();
}

这是我尝试测试条纹 Webhook 时遇到的 500 错误。

Test webhook error: 500
SymfonyComponentDebugExceptionFatalThrowableError: Class 'App/User' not found in file /.../vendor/laravel/cashier/src/Http/Controllers/StripeWebhookController.php on line 208

我的用户文件位于应用程序\用户中。她是我的用户文件

class User extends Authenticatable
{
use Notifiable, Billable;

protected $connection = 'mongodb';

/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'username', 'password', 'phone',
];
/**
* The collection name
*
* @var array
*/
protected $collection = 'users';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $dates = ['deleted_at'];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
}

这是我的配置.php

'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => AppUser::class,
],

请检查您的配置/身份验证.php文件并查找此代码

'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => AppUser::class,
],

检查模型是位于应用文件夹中还是位于应用\模型中?如果它在模型文件夹中,则使用AppModelsUser更改AppUser

如果不起作用,请尝试使用以下命令清除缓存:

php artisan config:cache
php artisan config:clear

最新更新