33 خطوط
910 B
PHP
33 خطوط
910 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
|
|
|
class SlaBreach extends Model
|
|
{
|
|
protected $fillable = ['sla_rule_id', 'breachable_type', 'breachable_id', 'assigned_to', 'status', 'due_at', 'warned_at', 'breached_at', 'resolved_at', 'event_key', 'details'];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return ['due_at' => 'datetime', 'warned_at' => 'datetime', 'breached_at' => 'datetime', 'resolved_at' => 'datetime', 'details' => 'array'];
|
|
}
|
|
|
|
public function rule(): BelongsTo
|
|
{
|
|
return $this->belongsTo(SlaRule::class, 'sla_rule_id');
|
|
}
|
|
|
|
public function assignee(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'assigned_to');
|
|
}
|
|
|
|
public function breachable(): MorphTo
|
|
{
|
|
return $this->morphTo();
|
|
}
|
|
}
|