fix: remove duplicate opening brace in ServiceController index method
This commit is contained in:
parent
292ad6b923
commit
5459529c3a
|
|
@ -15,9 +15,18 @@ class ServiceController extends Controller
|
||||||
{
|
{
|
||||||
public function index(): Response
|
public function index(): Response
|
||||||
{
|
{
|
||||||
$services = Service::query()
|
$archived = request()->boolean('archived');
|
||||||
->whereDate('date', '>=', Carbon::today())
|
|
||||||
->orderBy('date')
|
$query = Service::query();
|
||||||
|
if ($archived) {
|
||||||
|
$query->whereDate('date', '<', Carbon::today())
|
||||||
|
->orderByDesc('date');
|
||||||
|
} else {
|
||||||
|
$query->whereDate('date', '>=', Carbon::today())
|
||||||
|
->orderBy('date');
|
||||||
|
}
|
||||||
|
|
||||||
|
$services = $query
|
||||||
->withCount([
|
->withCount([
|
||||||
'serviceSongs as songs_total_count',
|
'serviceSongs as songs_total_count',
|
||||||
'serviceSongs as songs_mapped_count' => fn ($query) => $query->whereNotNull('song_id'),
|
'serviceSongs as songs_mapped_count' => fn ($query) => $query->whereNotNull('song_id'),
|
||||||
|
|
@ -59,6 +68,7 @@ public function index(): Response
|
||||||
|
|
||||||
return Inertia::render('Services/Index', [
|
return Inertia::render('Services/Index', [
|
||||||
'services' => $services,
|
'services' => $services,
|
||||||
|
'archived' => $archived,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue