mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
AlertLog model cast details (#15143)
* AlertLog model cast details * Style fix
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
|
||||||
class AlertLog extends DeviceRelatedModel
|
class AlertLog extends DeviceRelatedModel
|
||||||
@@ -11,4 +12,12 @@ class AlertLog extends DeviceRelatedModel
|
|||||||
public const UPDATED_AT = null;
|
public const UPDATED_AT = null;
|
||||||
public const CREATED_AT = 'time_logged';
|
public const CREATED_AT = 'time_logged';
|
||||||
protected $table = 'alert_log';
|
protected $table = 'alert_log';
|
||||||
|
|
||||||
|
protected function details(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn ($details) => json_decode(@gzuncompress($details), true) ?? [],
|
||||||
|
set: fn ($details) => gzcompress(json_encode($details)),
|
||||||
|
)->shouldCache();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user