belongsTo(SubscriptionCurrency::class); } protected $appends = ['full_price', 'tax_value', 'full_price_cents', 'can_purchase']; public function getCanPurchaseAttribute() { $company = \Auth::user()->companyContext(); $userRepo = App::make(UserRepository::class); $usersCount = $userRepo->countUsersForCompany($company); if ($this->teams_limit == null || $usersCount <= $this->teams_limit) { return true; } return false; } public function getFullPriceCentsAttribute() { if (!empty($this->tax_rate)) { $taxToPay = ($this->price / 100) * $this->tax_rate; $total = $this->price + $taxToPay; (int)(string)$total * 100; } return (int)(string)$this->price * 100; } public function getTaxValueAttribute() { if (!empty($this->tax_rate)) { return ($this->price / 100) * $this->tax_rate; } return 0; } public function getFullPriceAttribute() { if (!empty($this->tax_rate)) { $taxToPay = ($this->price / 100) * $this->tax_rate; $total = $this->price + $taxToPay; return $total; } return $this->price; } public static function boot() { parent::boot(); } }