32 lines
559 B
PHP
32 lines
559 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class WorkProduct extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'work_id',
|
|
'product_id',
|
|
'quantity_required',
|
|
'notes'
|
|
];
|
|
|
|
protected $casts = [
|
|
'quantity_required' => 'decimal:2'
|
|
];
|
|
|
|
public function work()
|
|
{
|
|
return $this->belongsTo(Work::class);
|
|
}
|
|
|
|
public function product()
|
|
{
|
|
return $this->belongsTo(Product::class);
|
|
}
|
|
}
|