belongsTo($this->entity_type, 'entity_id'); } public function voucher() { return $this->belongsTo(Voucher::class, 'entity_id'); } public function sale() { return $this->belongsTo(Sale::class, 'sale_id'); } public function shareWord(): Attribute { return Attribute::make(get: function () { $shareText = Setting::getByKey('SHARE_TEXT').' Kode Voucher : '.$this->voucher->username; return $shareText; }); } }