'boolean', 'price' => 'float', 'yearly_price' => 'float', 'max_users' => 'integer', 'max_employees' => 'integer', 'trial_day' => 'integer', ]; /** * Get the default plan * * @return Plan|null */ public static function getDefaultPlan() { if (!isSaas()) { return null; // No plans in non-SaaS } return self::where('is_default', true)->first(); } /** * Check if the plan is the default plan * * @return bool */ public function isDefault() { return (bool) $this->is_default; } /** * Get the price based on billing cycle * * @param string $cycle 'monthly' or 'yearly' * @return float */ public function getPriceForCycle($cycle = 'monthly') { if ($cycle === 'yearly' && $this->yearly_price) { return $this->yearly_price; } return $this->price; } /** * Get users subscribed to this plan */ public function users() { return $this->hasMany(User::class); } }