birthday); } public function getOrderNumAttribute() { return Order::where('patient_id', $this->id)->where('payment_status', 2)->where('product_type', '<', 6)->count(); } public function getPackDocterNumAttribute() { $team_ids = OrderPack::join('orders', 'orders.id', '=', 'order_packs.order_id')->where('orders.patient_id', $this->id)->where('orders.payment_status', 2)->where('orders.product_type', 7)->pluck('order_packs.team_id')->toArray(); return TeamDocter::whereIn('team_id', $team_ids)->count(); } public function getPerfectdDegreeAttribute() { $field = ['name', 'sex', 'avatar', 'birthday', 'relationship_type', 'card_number']; $total = count($field); $fill = 0; foreach ($field as $k => $v) { if (!empty($this->$v)) { $fill++; } } $text = round($fill/$total*100) . '%'; return $text; } }