38 lines
906 B
PHP
38 lines
906 B
PHP
<?php
|
|
|
|
namespace Modules\IndustrialEngineering\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class CompetitiveProduct extends Model
|
|
{
|
|
use BelongsToBusiness;
|
|
use SoftDeletes;
|
|
|
|
protected $table = 'ie_competitive_products';
|
|
|
|
protected $guarded = ['id'];
|
|
|
|
protected $casts = [
|
|
'estimated_price' => 'decimal:4',
|
|
'strengths' => 'array',
|
|
'weaknesses' => 'array',
|
|
];
|
|
|
|
public function researchProject()
|
|
{
|
|
return $this->belongsTo(ResearchProject::class, 'research_project_id');
|
|
}
|
|
|
|
public function structures()
|
|
{
|
|
return $this->hasMany(CompetitiveProductStructure::class, 'competitive_product_id');
|
|
}
|
|
|
|
public function rootStructures()
|
|
{
|
|
return $this->hasMany(CompetitiveProductStructure::class, 'competitive_product_id')->whereNull('parent_structure_id');
|
|
}
|
|
}
|