Cashier-stripe: Class 'App\User' not found

Created on 23 Feb 2019  路  8Comments  路  Source: laravel/cashier-stripe

Having the error when i try to swap a braintree subscription.Please help.

Most helpful comment

or use .env to setup the cashier model:
CASHIER_MODEL=App\Models\User
https://laravel.com/docs/6.x/billing#billable-model

All 8 comments

Did you add use App\User; to the top of your file, beneath the namespace?

am using

use App\Models\User;

Is your User model in a Models folder and namespaced as App/Models/User?

@snipe Yes

The error is in this file.

vendor/laravel/cashier-braintree/src/Subscription.php

In owner function

    public function owner()
    {
        $model = getenv('BRAINTREE_MODEL') ?: config('services.braintree.model', 'App\\User');

        $model = new $model;

        return $this->belongsTo(get_class($model), $model->getForeignKey());
    }

I have fixed it in config('services.braintree.model', 'App\\User')

Now its
config('cashier.model')

or use .env to setup the cashier model:
CASHIER_MODEL=App\Models\User
https://laravel.com/docs/6.x/billing#billable-model

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AnalyzeMe picture AnalyzeMe  路  5Comments

tonystatic picture tonystatic  路  5Comments

4UForever picture 4UForever  路  3Comments

MarGul picture MarGul  路  5Comments

tania-pets picture tania-pets  路  3Comments