-
app/Observers/DomainObserver.php
Open in GitHubuse Illuminate\Support\Facades\Redis; use App\Models\Domain; class DomainObserver { protected $redis; public function __construct() { $this->redis = Redis::connection('default'); } public function created(Domain $domain): void { $this->redis->set($domain->domain, "lua.sha"); } public function updated(Domain $domain): void { $this->redis->del($domain->getOriginal('domain')); $this->redis->set($domain->domain, "lua.sha"); } public function deleted(Domain $domain): void { $this->redis->del($domain->domain); } }
-
app/Observers/DomainObserver.php
Open in GitHubuse App\Observers\WorkspaceObserver; use Illuminate\Database\Eloquent\Attributes\ObservedBy; #[ObservedBy(WorkspaceObserver::class)] class Workspace extends Model implements HasMedia { // ... }