<?php


namespace App\Extensions;


use App\Subscription;
use App\UserSubscription;
use Laravel\Cashier\Billable;

trait CustomCompanyBillableTrait {
    use Billable;

    /**
     * Get a subscription instance by name.
     *
     * @param  string  $subscription
     * @return \Laravel\Cashier\Subscription|null
     */
    public function subscription($subscription_id, $type = "company") {
        if($type=="company")
            return Subscription::find($subscription_id);
        else
            return UserSubscription::find($subscription_id);
    }
}
