'date', 'freight' => 'decimal:2', 'total_amount' => 'decimal:2', 'pushed' => 'boolean', 'pushed_to_cloud' => 'boolean', 'pushed_at' => 'datetime', ]; public function warehouse() { return $this->belongsTo(Warehouse::class); } public function supplier() { return $this->belongsTo(Supplier::class); } public function brand() { return $this->belongsTo(Brand::class); } public function items() { return $this->hasMany(PurchaseOrderItem::class); } public function receivingOrders() { return $this->hasMany(ReceivingOrder::class, 'po_id'); } public function getStatusLabelAttribute() { $labels = [ 'draft' => '草稿', 'under_review' => '待审核', 'approved' => '已审核', 'rejected' => '已驳回', 'completed' => '已完成', ]; return $labels[$this->status] ?? $this->status; } }