GrafiteInc/Scaffold

View on GitHub
app/Models/Concerns/HasSubscribedUser.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace App\Models\Concerns;

use Illuminate\Support\Facades\Gate;

trait HasSubscribedUser
{
    /**
     * Check if the model user has an active subscription
     * in any possible state.
     *
     * @return bool
     */
    public function hasActiveSubscription()
    {
        return Gate::forUser($this->user)->allows('subscribed');
    }
}