CRM/backend/app/Models/SlaRule.php

28 خطوط
720 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class SlaRule extends Model
{
protected $fillable = ['name', 'event', 'warning_minutes', 'breach_minutes', 'scope', 'is_active', 'created_by'];
protected function casts(): array
{
return ['warning_minutes' => 'integer', 'breach_minutes' => 'integer', 'scope' => 'array', 'is_active' => 'boolean'];
}
public function creator(): BelongsTo
{
return $this->belongsTo(User::class, 'created_by');
}
public function breaches(): HasMany
{
return $this->hasMany(SlaBreach::class);
}
}