'object', 'updated_at' => 'timestamp', 'created_at' => 'timestamp', 'deleted_at' => 'timestamp', ]; public function client() { return $this->belongsTo(Client::class); } public function company() { return $this->belongsTo(Company::class); } public function user() { return $this->belongsTo(User::class); } public function documents() { return $this->morphMany(Document::class, 'documentable'); } public function invoices() { return $this->morphedByMany(Invoice::class, 'paymentable'); } public function company_ledger() { return $this->morphMany(CompanyLedger::class, 'company_ledgerable'); } public function type() { return $this->hasOne(PaymentType::class,'id','payment_type_id'); } public static function badgeForStatus(int $status) { switch ($status) { case self::STATUS_PENDING: return '
'.ctrans('texts.payment_status_1').'
'; break; case self::STATUS_VOIDED: return '
'.ctrans('texts.payment_status_2').'
'; break; case self::STATUS_FAILED: return '
'.ctrans('texts.payment_status_3').'
'; break; case self::STATUS_COMPLETED: return '
'.ctrans('texts.payment_status_4').'
'; break; case self::STATUS_PARTIALLY_REFUNDED: return '
'.ctrans('texts.payment_status_5').'
'; break; case self::STATUS_REFUNDED: return '
'.ctrans('texts.payment_status_6').'
'; break; default: # code... break; } } }