Problem with Cashier in Laravel 5.4
I have followed the instructions in the docs for installing Cashier ~7.0. I have my Stripe Keys in the .env file. When I register an account the customer and subscription records are added to my Stripe dashboard as expected.
However, I cannot use the Laravel methods like ->swap(), or ->downloadInvoice(). I have used Stripe in Laravel 4 for a few years, but for some reason cannot figure out how to get it working in version 5. Every time I try to do this I get errors:
BadMethodCallException in Builder.php line 2443: Call to undefined method Illuminate\Database\Query\Builder::downloadInvoice()
I am using a companies table to hold the stripe information instead of users.
Schema::create('subscriptions', function ($table) {
$table->increments('id');
$table->integer('company_id');
$table->string('name');
$table->string('stripe_id');
$table->string('stripe_plan');
$table->integer('quantity');
$table->integer('user_limit')->unsigned()->nullable();
$table->timestamp('trial_ends_at')->nullable();
$table->timestamp('ends_at')->nullable();
$table->timestamps();
});
In my company model I have
namespace App;
use Carbon\Carbon;
use Laravel\Cashier\Billable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Company extends Model
{
use Billable, SoftDeletes;
......
}
Please or to participate in this conversation.