40 lines
799 B
PHP
40 lines
799 B
PHP
<?php
|
|
|
|
namespace Modules\QualityManagement\Models;
|
|
|
|
use App\User;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class NcrReport extends Model
|
|
{
|
|
use BelongsToBusiness;
|
|
use SoftDeletes;
|
|
|
|
protected $table = 'qms_ncr_reports';
|
|
|
|
protected $guarded = ['id'];
|
|
|
|
protected $casts = [
|
|
'detected_at' => 'date',
|
|
'closed_at' => 'date',
|
|
'containment_actions' => 'array',
|
|
'meta' => 'array',
|
|
];
|
|
|
|
public function capaActions()
|
|
{
|
|
return $this->hasMany(CapaAction::class, 'ncr_id');
|
|
}
|
|
|
|
public function reportedBy()
|
|
{
|
|
return $this->belongsTo(User::class, 'reported_by');
|
|
}
|
|
|
|
public function assignedTo()
|
|
{
|
|
return $this->belongsTo(User::class, 'assigned_to');
|
|
}
|
|
}
|