'json', ]; /* RELATIONS */ public function payments() { return $this->hasMany(Payment::class); } /* STATIC METHODS */ public static function available(): Collection { return self::active()->get(); } /* ATTRIBUTES */ public function getIconAttribute(): string { switch(strtolower($this->name)) { case 'paypal': return 'fab fa-cc-paypal'; default: return 'fas fa-money-bill-alt'; } } /* METHODS */ public function fee(float $amt,int $items=1): float { if (! $this->fee_passon OR ! $items) return 0; $fee = $amt+$this->fee_fixed/$items; $fee /= (1-$this->fee_variable); return round($fee-$amt,2); } }