Add follow system, activity feed, notifications, sitemap, caching, Scout search

This commit is contained in:
Mark
2026-05-30 11:23:24 +03:00
parent 5c6ba86e15
commit 3083071a6c
24 changed files with 1657 additions and 49 deletions
+15 -1
View File
@@ -5,12 +5,14 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Facades\Cache;
use Laravel\Scout\Searchable;
use Spatie\Sluggable\HasSlug;
use Spatie\Sluggable\SlugOptions;
class Game extends Model
{
use HasSlug;
use HasSlug, Searchable;
protected $fillable = [
'igdb_id', 'slug', 'title', 'summary', 'cover_url', 'cover_thumb_url',
@@ -60,6 +62,15 @@ class Game extends Model
return $this->hasMany(Review::class)->latest();
}
public function toSearchableArray(): array
{
return [
'id' => $this->id,
'title' => $this->title,
'summary' => $this->summary,
];
}
public function scopePublished($query)
{
return $query->where('status', 'published');
@@ -72,5 +83,8 @@ class Game extends Model
'rating_avg' => $stats->avg ? round($stats->avg, 2) : null,
'rating_count' => $stats->cnt ?? 0,
]);
Cache::forget('home.top_rated');
Cache::forget('games.top_rated.1');
}
}