'integer', ]; /** * 关联仓库 */ public function warehouse() { return $this->belongsTo(Warehouse::class); } /** * 关联订单(可选) */ public function order() { return $this->belongsTo(Order::class); } /** * 获取类型标签 */ public function getTypeLabelAttribute() { $map = [ 'inbound' => '入库', 'outbound' => '出库', 'lock' => '占用', 'unlock' => '释放占用', 'ship' => '发货出库', 'defective_inbound' => '残次品入库', 'adjust' => '手动调整', ]; return $map[$this->type] ?? $this->type; } }