- Order 모델: product_id 제거, item_id 추가, item() 관계 추가 - OrderItem 모델: product_id 제거, item_id 추가, item() 관계 추가 - Quote 모델: product_id 제거, item_id 추가, item() 관계 추가 - MaterialReceipt 모델: material_id 제거, item_id 추가, material() → item() 변경 - Lot 모델: Material import 제거, material() → item() 변경 DB 스키마는 이미 마이그레이션됨 (2025_12_13_153544) 기존 product_id/material_id 컬럼은 DB에 남아있지만 fillable에서 제거 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
49 lines
1.0 KiB
PHP
49 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Orders;
|
|
|
|
use App\Models\Items\Item;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
/**
|
|
* @mixin IdeHelperOrder
|
|
*/
|
|
class Order extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
// 주문(견적/수주/발주 메인)
|
|
protected $table = 'orders';
|
|
|
|
protected $fillable = [
|
|
'tenant_id', 'order_no', 'order_type_code', 'status_code', 'category_code', 'item_id',
|
|
'received_at', 'writer_id', 'client_id', 'client_contact', 'site_name', 'quantity', 'delivery_date',
|
|
'delivery_method_code', 'memo',
|
|
];
|
|
|
|
// 상세(라인)
|
|
public function items()
|
|
{
|
|
return $this->hasMany(OrderItem::class);
|
|
}
|
|
|
|
// 이력
|
|
public function histories()
|
|
{
|
|
return $this->hasMany(OrderHistory::class);
|
|
}
|
|
|
|
// 버전관리
|
|
public function versions()
|
|
{
|
|
return $this->hasMany(OrderVersion::class);
|
|
}
|
|
|
|
// 품목 (통합 items 테이블)
|
|
public function item()
|
|
{
|
|
return $this->belongsTo(Item::class, 'item_id');
|
|
}
|
|
}
|