Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

luadotsh/lua

324 stars
2 code files
View luadotsh/lua on GitHub

app/Observers/DomainObserver.php

Open in GitHub
use 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 GitHub
use App\Observers\WorkspaceObserver;
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
 
#[ObservedBy(WorkspaceObserver::class)]
class Workspace extends Model implements HasMedia
{
// ...
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.