laravel / cashier-stripe

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.
https://laravel.com/docs/billing
MIT License
2.37k stars 671 forks source link

Class 'App\User' not found #610

Closed gathuku closed 5 years ago

gathuku commented 5 years ago

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

snipe commented 5 years ago

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

gathuku commented 5 years ago

am using

use App\Models\User;
snipe commented 5 years ago

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

gathuku commented 5 years ago

@snipe Yes

gathuku commented 5 years ago

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());
    }
gathuku commented 5 years ago

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

JexPY commented 5 years ago

Now its config('cashier.model')

piotrku commented 4 years ago

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