Ad

Laravel 5.2 And Cashier

I have added:

"laravel/cashier": "^6.0"

to composer.json

and:

Laravel\Cashier\CashierServiceProvider::class,

to app.php in the providers array in the config folder.

I have then run composer update, but if I do:

php artisan

I do not see the cashier command there. Am I missing a step?

Ad

Answer

That command appears to be removed in 5.2. In looking at the docs for 5.2 they've been updated and there is no longer a reference to using the artisan helper `$php artisan cashier:table users

Rather is seems you must now create the migration manually rather than using a helper. From the docs:

Update the user table migration(or whichever entity you are associating with your billing):

Schema::table('users', function ($table) {
    $table->string('stripe_id')->nullable();
    $table->string('card_brand')->nullable();
    $table->string('card_last_four')->nullable();
});

Create a subscriptions table:

Schema::create('subscriptions', function ($table) {
    $table->increments('id');
    $table->integer('user_id');
    $table->string('name');
    $table->string('stripe_id');
    $table->string('stripe_plan');
    $table->integer('quantity');
    $table->timestamp('trial_ends_at')->nullable();
    $table->timestamp('ends_at')->nullable();
    $table->timestamps();
});

Then run the migrate command $ php artisan migrate

I wasn't able to find any info on the reason for this change or whether they'll be re-introducing this artisan command in the future. I assume it is by design though.

Click here for more info on creating migrations.

Hope it helps!

Ad
source: stackoverflow.com
Ad