fix : 모델 경로 수정
This commit is contained in:
42
app/Models/Materials/Material.php
Normal file
42
app/Models/Materials/Material.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Materials;
|
||||
|
||||
use App\Models\File;
|
||||
use App\Models\Qualitys\Lot;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Material extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
// 자재(품목) 마스터
|
||||
protected $fillable = [
|
||||
'name', // 자재명(품명)
|
||||
'specification', // 규격
|
||||
'material_code', // 자재코드
|
||||
'unit', // 단위
|
||||
'is_inspection', // 검사대상 여부(Y/N)
|
||||
'search_tag', // 검색 태그
|
||||
'remarks', // 비고
|
||||
];
|
||||
|
||||
|
||||
// 자재 입고 내역
|
||||
public function receipts()
|
||||
{
|
||||
return $this->hasMany(MaterialReceipt::class, 'material_id');
|
||||
}
|
||||
|
||||
// 로트 관리
|
||||
public function lots()
|
||||
{
|
||||
return $this->hasMany(Lot::class, 'material_id');
|
||||
}
|
||||
|
||||
public function files()
|
||||
{
|
||||
return $this->morphMany(File::class, 'fileable');
|
||||
}
|
||||
}
|
||||
23
app/Models/Materials/MaterialInspection.php
Normal file
23
app/Models/Materials/MaterialInspection.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Materials;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class MaterialInspection extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
// 입고 내역
|
||||
public function receipt()
|
||||
{
|
||||
return $this->belongsTo(MaterialReceipt::class, 'receipt_id');
|
||||
}
|
||||
|
||||
// 검사 항목
|
||||
public function items()
|
||||
{
|
||||
return $this->hasMany(MaterialInspectionItem::class, 'inspection_id');
|
||||
}
|
||||
}
|
||||
17
app/Models/Materials/MaterialInspectionItem.php
Normal file
17
app/Models/Materials/MaterialInspectionItem.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Materials;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class MaterialInspectionItem extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
// 검사 내역
|
||||
public function inspection()
|
||||
{
|
||||
return $this->belongsTo(MaterialInspection::class, 'inspection_id');
|
||||
}
|
||||
}
|
||||
29
app/Models/Materials/MaterialReceipt.php
Normal file
29
app/Models/Materials/MaterialReceipt.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Materials;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class MaterialReceipt extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'material_id', 'receipt_date', 'lot_number', 'received_qty', 'unit',
|
||||
'supplier_name', 'manufacturer_name', 'purchase_price_excl_vat',
|
||||
'weight_kg', 'status_code', 'is_inspection', 'inspection_date', 'remarks'
|
||||
];
|
||||
|
||||
// 자재 마스터
|
||||
public function material()
|
||||
{
|
||||
return $this->belongsTo(Material::class, 'material_id');
|
||||
}
|
||||
|
||||
// 수입검사 내역
|
||||
public function inspections()
|
||||
{
|
||||
return $this->hasMany(MaterialInspection::class, 'receipt_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user