belongsTo(Prompt::class, 'prompt_id'); } public function order() { return $this->belongsTo(Order::class, 'order_id'); } public function review() { return $this->hasOne(Review::class, 'prompt_id', 'prompt_id') ->where('user_id', $this->order->user_id); } public function seller() { return $this->belongsTo(User::class, 'seller_id'); } public function statusBadge(): Attribute { return new Attribute( get: fn() => $this->badgeData(), ); } public function badgeData() { $html = ''; if ($this->status == Status::ORDER_PENDING) { $html = '' . trans('Pending'); } elseif ($this->status == Status::ORDER_COMPLETED) { $html = '' . trans('Completed'); } elseif ($this->status == Status::ORDER_CANCEL) { $html = '' . trans('Cancelled'); } return $html; } }