fix : 모델, BOM 구성 수정
- 설계용 모델, BOM 기능 추가
This commit is contained in:
35
app/Models/Design/ModelVersion.php
Normal file
35
app/Models/Design/ModelVersion.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Design;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class ModelVersion extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'model_versions';
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id','model_id','version_no','status','effective_from','effective_to','notes','is_active',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'is_active' => 'boolean',
|
||||
'effective_from' => 'datetime',
|
||||
'effective_to' => 'datetime',
|
||||
];
|
||||
|
||||
public function model() {
|
||||
return $this->belongsTo(DesignModel::class, 'model_id');
|
||||
}
|
||||
|
||||
public function bomTemplates() {
|
||||
return $this->hasMany(BomTemplate::class, 'model_version_id');
|
||||
}
|
||||
|
||||
public function scopeReleased($q) {
|
||||
return $q->where('status', 'RELEASED');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user