Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions app/Http/Controllers/ThemesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ThemesController extends Controller
{
public function index()
{
$availableCategories = Cache::remember('themes:available_categories', 3600, fn() => Theme::query()
$availableCategories = Cache::remember('themes:available_categories', 3600, fn () => Theme::query()
->select('categories')
->get()
->pluck('categories')
Expand All @@ -24,7 +24,7 @@ public function index()
'themes' => Inertia::scroll(Theme::paginate(12)->withQueryString()),
'filters' => request()->only(['search', 'category']),
'availableCategories' => $availableCategories,
'totalThemesCount' => Cache::remember('themes:total_count', 3600, fn() => Theme::count()),
'totalThemesCount' => Cache::remember('themes:total_count', 3600, fn () => Theme::count()),
]);
}

Expand All @@ -33,7 +33,7 @@ public function apiIndex()
$query = Theme::query();

if ($search = request('search')) {
$query->where(fn($q) => $q
$query->where(fn ($q) => $q
->where('name', 'like', "%{$search}%")
->orWhere('title', 'like', "%{$search}%")
->orWhere('description', 'like', "%{$search}%")
Expand All @@ -43,6 +43,13 @@ public function apiIndex()
return $query->paginate(50)->withQueryString();
}

public function show(Theme $theme)
{
return Inertia::render('themes/show', [
'theme' => $theme,
]);
}

public function css(string $name)
{
return response(
Expand Down
Loading
Loading