Laing
Laing

Reputation: 3

Class 'App/User' not found in file .... WebhookController.php on line 208 Laravel Cashier Stripe Webhook

Here is the portion of my Webhook Controller where it says the error is. Everything looks correct to me. What might I be missing?

Also, only the handle payment invoice webhook works, everything else gives me the 500 error below.

  /**
 * Get the billable entity instance by Stripe ID.
 *
 * @param  string|null  $stripeId
 * @return \Laravel\Cashier\Billable|null
 */
protected function getUserByStripeId($stripeId)
{
    if ($stripeId === null) {
        return;
    }

    $model = config('cashier.model');

    return (new $model)->where('stripe_id', $stripeId)->first();

}

Here is the 500 error I get when I try to test the stripe Webhook.

Test webhook error: 500

Symfony\Component\Debug\Exception\FatalThrowableError: Class 'App/User' not found in file /.../vendor/laravel/cashier/src/Http/Controllers/StripeWebhookController.php on line 208

My user file is in App\User. Her is my User file

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',
];

}

Here is my config\auth.php

'providers' => [
    'users' => [
        'driver' => 'eloquent',
        'model' => App\User::class,
    ],

Upvotes: 0

Views: 243

Answers (1)

user10678889
user10678889

Reputation:

Please check your config/auth.php file and look for this code

'providers' => [
    'users' => [
        'driver' => 'eloquent',
        'model' => App\User::class,
    ],

Check whether your model is located in app folder or in app\Models? If it is in model folder, then change App\User with App\Models\User.

If it does not work, pplease try to clear the cache using these commands:

php artisan config:cache
php artisan config:clear

Upvotes: 1

Related Questions