$user_id, 'type' => $type, 'relation_id' => $relation_id, 'content' => $content, ]); return true; } public function getProductTypeAttribute() { if (in_array($this->type, [1,2,4,5,6,7,8]) && !empty($this->relation_id)) { return Order::where('id', $this->relation_id)->value('product_type'); } return 0; } public function getOrderStatusAttribute() { $status = 0; if (!empty($this->relation_id)) { $status = Order::where('id', $this->relation_id)->value('order_status'); } return $status; } }