chore: commit remaining workspace changes
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace App\Services\Academy;
|
||||
|
||||
use App\Models\AcademyCategory;
|
||||
use App\Models\AcademyCourse;
|
||||
use App\Models\AcademyChallenge;
|
||||
use App\Models\AcademyLesson;
|
||||
use App\Models\AcademyPromptTemplate;
|
||||
@@ -14,6 +15,8 @@ final class AcademyCacheService
|
||||
{
|
||||
private const HOME_KEY = 'academy.home';
|
||||
private const FEATURED_LESSONS_KEY = 'academy.featured_lessons';
|
||||
private const FEATURED_COURSES_KEY = 'academy.featured_courses';
|
||||
private const PUBLISHED_COURSES_KEY = 'academy.published_courses';
|
||||
private const FEATURED_PROMPTS_KEY = 'academy.featured_prompts';
|
||||
private const FEATURED_CHALLENGES_KEY = 'academy.featured_challenges';
|
||||
private const CATEGORIES_KEY = 'academy.categories';
|
||||
@@ -30,12 +33,32 @@ final class AcademyCacheService
|
||||
->active()
|
||||
->published()
|
||||
->where('featured', true)
|
||||
->latest('published_at')
|
||||
->orderedForCourse()
|
||||
->limit(6)
|
||||
->get()
|
||||
->all());
|
||||
}
|
||||
|
||||
public function featuredCourses(): array
|
||||
{
|
||||
return Cache::remember(self::FEATURED_COURSES_KEY, $this->ttl(), static fn (): array => AcademyCourse::query()
|
||||
->published()
|
||||
->featured()
|
||||
->ordered()
|
||||
->limit(6)
|
||||
->get()
|
||||
->all());
|
||||
}
|
||||
|
||||
public function publishedCourses(): array
|
||||
{
|
||||
return Cache::remember(self::PUBLISHED_COURSES_KEY, $this->ttl(), static fn (): array => AcademyCourse::query()
|
||||
->published()
|
||||
->ordered()
|
||||
->get()
|
||||
->all());
|
||||
}
|
||||
|
||||
public function featuredPrompts(): array
|
||||
{
|
||||
return Cache::remember(self::FEATURED_PROMPTS_KEY, $this->ttl(), static fn (): array => AcademyPromptTemplate::query()
|
||||
@@ -79,6 +102,8 @@ final class AcademyCacheService
|
||||
{
|
||||
Cache::forget(self::HOME_KEY);
|
||||
Cache::forget(self::FEATURED_LESSONS_KEY);
|
||||
Cache::forget(self::FEATURED_COURSES_KEY);
|
||||
Cache::forget(self::PUBLISHED_COURSES_KEY);
|
||||
Cache::forget(self::FEATURED_PROMPTS_KEY);
|
||||
Cache::forget(self::FEATURED_CHALLENGES_KEY);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user