Adity salunkhe
Adity salunkhe

Reputation: 51

Undefined type 'Laravel\Cashier\Cashier'.intelephense(1009)

I am new to laravel I want to integrate subscription module in my project as I followed the following process till now.

  1. composer require laravel/cashier

  2. php artisan vendor:publish --tag="cashier-migrations"

  3. Update User Model

    use Laravel\Cashier\Billable;
    
    class User extends Authenticatable
    {
        use Billable;
    } 
  1. .env

    CASHIER_MODEL=App\Models\User


Need suggestions where I am going wrong.

Undefined Laravel/Cashier/Cashier

Upvotes: 3

Views: 1056

Answers (2)

sharad paudel
sharad paudel

Reputation: 61

I also had the same problem. I closed my IDE and restarted it and the error was gone. - sharad paudel

EDIT: I can confirm that restarting VS Code is a solution to this problem. I'm also using Laravel / Cashier, and I came across a similar situation. VS Code was giving me the red squiggly lines inside the actual Billable trait file: src/vendor/laravel/cashier/src/Billable.php similar to the OP. It seems like it isn't an "error" so much as a minor confusion in VS Code - I had all the correct "use" import lines. After restarting VS Code, all file associations seemed to be fine, and all the red squiggles were gone. I have also seen this happen before, after installing something with "composer", a restart was needed to make VS Code happy. -dogatonic

Upvotes: 5

Ohidul
Ohidul

Reputation: 192

Add Billable after using the comma (,); use HasApiTokens, HasFactory, Notifiable. Write it like

use HasApiTokens, HasFactory, Notifiable, Billable;

Upvotes: 1

Related Questions