2022-01-29 21:09:05 -06:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
2023-07-24 10:01:07 -05:00
|
|
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
2022-01-29 21:09:05 -06:00
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
|
|
|
|
class AlertLog extends DeviceRelatedModel
|
|
|
|
{
|
|
|
|
use HasFactory;
|
|
|
|
|
|
|
|
public const UPDATED_AT = null;
|
|
|
|
public const CREATED_AT = 'time_logged';
|
|
|
|
protected $table = 'alert_log';
|
2023-07-24 10:01:07 -05:00
|
|
|
|
|
|
|
protected function details(): Attribute
|
|
|
|
{
|
|
|
|
return Attribute::make(
|
|
|
|
get: fn ($details) => json_decode(@gzuncompress($details), true) ?? [],
|
|
|
|
set: fn ($details) => gzcompress(json_encode($details)),
|
|
|
|
)->shouldCache();
|
|
|
|
}
|
2022-01-29 21:09:05 -06:00
|
|
|
}
|