68 lines
1.5 KiB
PHP
68 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace Modules\IndustrialEngineering\Models;
|
|
|
|
use App\Business;
|
|
use App\Product;
|
|
use App\Variation;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class ItemMaster extends Model
|
|
{
|
|
use BelongsToBusiness;
|
|
use SoftDeletes;
|
|
|
|
protected $table = 'ie_item_masters';
|
|
|
|
protected $guarded = ['id'];
|
|
|
|
protected $casts = [
|
|
'is_serialized' => 'boolean',
|
|
'is_serviceable' => 'boolean',
|
|
'is_consumable' => 'boolean',
|
|
'standard_cost' => 'decimal:4',
|
|
'specifications' => 'array',
|
|
];
|
|
|
|
public function business()
|
|
{
|
|
return $this->belongsTo(Business::class);
|
|
}
|
|
|
|
public function revisions()
|
|
{
|
|
return $this->hasMany(ItemRevision::class, 'item_master_id');
|
|
}
|
|
|
|
public function manufacturer()
|
|
{
|
|
return $this->belongsTo(Manufacturer::class, 'default_manufacturer_id');
|
|
}
|
|
|
|
public function variation()
|
|
{
|
|
return $this->belongsTo(Variation::class);
|
|
}
|
|
|
|
public function product()
|
|
{
|
|
return $this->belongsTo(Product::class);
|
|
}
|
|
|
|
public function equivalents()
|
|
{
|
|
return $this->hasMany(PartEquivalent::class, 'primary_item_id');
|
|
}
|
|
|
|
public function supplierPartNumbers()
|
|
{
|
|
return $this->hasMany(SupplierPartNumber::class, 'item_master_id');
|
|
}
|
|
|
|
public function classifications()
|
|
{
|
|
return $this->hasMany(ItemClassification::class, 'item_master_id');
|
|
}
|
|
}
|