feat: increase gallery grid from 4 to 5 columns per row on desktopfeat: increase gallery grid from 4 to 5 columns per row on desktop
This commit is contained in:
40
app/Observers/ArtworkAwardObserver.php
Normal file
40
app/Observers/ArtworkAwardObserver.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Observers;
|
||||
|
||||
use App\Models\ArtworkAward;
|
||||
use App\Services\ArtworkAwardService;
|
||||
|
||||
class ArtworkAwardObserver
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ArtworkAwardService $service
|
||||
) {}
|
||||
|
||||
public function created(ArtworkAward $award): void
|
||||
{
|
||||
$this->refresh($award);
|
||||
}
|
||||
|
||||
public function updated(ArtworkAward $award): void
|
||||
{
|
||||
$this->refresh($award);
|
||||
}
|
||||
|
||||
public function deleted(ArtworkAward $award): void
|
||||
{
|
||||
$this->refresh($award);
|
||||
}
|
||||
|
||||
private function refresh(ArtworkAward $award): void
|
||||
{
|
||||
$this->service->recalcStats($award->artwork_id);
|
||||
|
||||
$artwork = $award->artwork;
|
||||
if ($artwork) {
|
||||
$this->service->syncToSearch($artwork);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user