public static function startFreeTrial(Companies $company): Suscriptions
    {
        $subscription = new self();
        $subscription->plans_id = self::FREE_TRIAL;
        $subscription->users_id = $company->users_id;
        $subscription->apps_id = self::DEFAULT_APP;
        $subscription->stripe_id = '';
        $subscription->company_id = $company->getId();
        $subscription->stripe_plan = 'Free Trial';
        $subscription->quantity = 1;
        $subscription->trial_ends_at = date('Y-m-d H:i:s', strtotime('+30 days'));
        $subscription->ends_at = date('Y-m-d H:i:s', strtotime('+30 days'));

        if (!$subscription->save()) {
            throw new Exception(current($subscription->getMessages()));
        }

        return $subscription;
    }
public static function startFreeTrial(Companies $company): Suscriptions
    {
        $subscription = new self();
        $subscription->plans_id = self::FREE_TRIAL;
        $subscription->users_id = $company->users_id;
        $subscription->apps_id = self::DEFAULT_APP;
        $subscription->stripe_id = '';
        $subscription->company_id = $company->getId();
        $subscription->stripe_plan = 'Free Trial';
        $subscription->quantity = 1;
        $subscription->trial_ends_at = date('Y-m-d H:i:s', strtotime('+30 days'));
        $subscription->ends_at = date('Y-m-d H:i:s', strtotime('+30 days'));

        if (!$subscription->save()) {
            throw new Exception(current($subscription->getMessages()));
        }

        return $subscription;
    }
public static function startFreeTrial ( Companies $ company ) : Suscriptions { $ subscription = new self ( ) ; $ subscription -> plans_id = self :: FREE_TRIAL ; $ subscription -> users_id = $ company -> users_id ; $ subscription -> apps_id = self :: DEFAULT_APP ; $ subscription -> stripe_id = '' ; $ subscription -> company_id = $ company -> getId ( ) ; $ subscription -> stripe_plan = 'Free Trial' ; $ subscription -> quantity = 1 ; $ subscription -> trial_ends_at = date ( 'Y-m-d H:i:s' , strtotime ( '+30 days' ) ) ; $ subscription -> ends_at = date ( 'Y-m-d H:i:s' , strtotime ( '+30 days' ) ) ; if ( ! $ subscription -> save ( ) ) { throw new Exception ( current ( $ subscription -> getMessages ( ) ) ) ; } return $ subscription ; }
Start a free trial to the system

@param  Companies $company
@return Subscription
Start a free trial to the system