40 lines
990 B
PHP
40 lines
990 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\Concerns\InteractsWithActivityLog;
|
|
use Illuminate\Database\Eloquent\Attributes\Guarded;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
#[Guarded(['id'])]
|
|
class CuttingMaterialCombination extends Model
|
|
{
|
|
use HasFactory, InteractsWithActivityLog, SoftDeletes;
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'material_result' => 'integer',
|
|
];
|
|
}
|
|
|
|
public function cutting(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Cutting::class)->withTrashed();
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class)->withTrashed();
|
|
}
|
|
|
|
public function materials(): HasMany
|
|
{
|
|
return $this->hasMany(CuttingMaterial::class, 'combination_id');
|
|
}
|
|
}
|