mercredi 8 mars 2017

Laravel Cashier Call to Undefined Method onGracePeriod()

So I recently upgraded from Laravel 5.1 -> 5.4 and Cashier from 5.0 -> 7.0. In my blade I am using this check to see if a user is in their grace period

<?php if(Auth::check() && Auth::user()->onGracePeriod()): ?>

However now this code throws an exception

Call to undefined method Illuminate\Database\Query\Builder::onGracePeriod()

As per the documentation my user model has the import

use Laravel\Cashier\Billable;

and the use statement inside of the class itself

class User extends Model implements AuthenticatableContract, 

CanResetPasswordContract
{
     use Authenticatable, CanResetPassword, Billable;
    /**
     * The database table used by the model.
     *
     * @var string
...

Is there anything else that could cause this error? Searching through the code it looks like the function is within the Subscription.php within cashier but I cannot seem to find a fix. I also have the included dates that is often referenced in the documentation

protected $dates = ['trial_ends_at', 'subscription_ends_at'];

But I had that and my DB using that before back on 5.1 so I doubt that is related. Any ideas? The only thing I can think of is that when moving from 5.1 -> 5.4 I had to remove the "BillableContract" since it appears that it is no longer being used, is there something I have to replace that with? Thanks!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire