You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
931 B

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class CameraAlert extends Model
{
protected $fillable = ['camera_device_id','venue_id','alert_type','status','severity','title','reason','first_occurred_at','last_occurred_at','recovered_at','last_notified_at','notification_count','acknowledged_by','acknowledged_at','remark'];
protected $casts = ['first_occurred_at'=>'datetime','last_occurred_at'=>'datetime','recovered_at'=>'datetime','last_notified_at'=>'datetime','acknowledged_at'=>'datetime'];
public function camera(): BelongsTo { return $this->belongsTo(CameraDevice::class, 'camera_device_id'); }
public function venue(): BelongsTo { return $this->belongsTo(Venue::class); }
public function notifications(): HasMany { return $this->hasMany(CameraAlertNotification::class); }
}