Add notification inbox, toasts and alert scanner for orders, prints and filament
Deploy HickLab3D Dashboard / Deploy to production (push) Successful in 28s
Deploy HickLab3D Dashboard / Deploy to production (push) Successful in 28s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
04be9802dc
commit
ab1fdb961f
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Remembers what the alert scanner has already seen so each event notifies once.
|
||||
*/
|
||||
class AlertState extends Model
|
||||
{
|
||||
public $incrementing = false;
|
||||
|
||||
protected $primaryKey = 'key';
|
||||
|
||||
protected $keyType = 'string';
|
||||
|
||||
protected $fillable = ['key', 'state'];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return ['state' => 'array'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>|null
|
||||
*/
|
||||
public static function read(string $key): ?array
|
||||
{
|
||||
return static::find($key)?->state;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $state
|
||||
*/
|
||||
public static function write(string $key, array $state): void
|
||||
{
|
||||
static::updateOrCreate(['key' => $key], ['state' => $state]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user