ultimatepos/Modules/IndustrialEngineering/Models/CompetitiveProductStructure.php

33 lines
774 B
PHP

<?php
namespace Modules\IndustrialEngineering\Models;
use Illuminate\Database\Eloquent\Model;
class CompetitiveProductStructure extends Model
{
protected $table = 'ie_competitive_product_structures';
protected $guarded = ['id'];
protected $casts = [
'quantity' => 'decimal:4',
'estimated_unit_cost' => 'decimal:4',
];
public function competitiveProduct()
{
return $this->belongsTo(CompetitiveProduct::class, 'competitive_product_id');
}
public function parentStructure()
{
return $this->belongsTo(CompetitiveProductStructure::class, 'parent_structure_id');
}
public function children()
{
return $this->hasMany(CompetitiveProductStructure::class, 'parent_structure_id');
}
}