2024-06-24 15:02:43 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Club;
|
|
|
|
|
|
|
|
|
|
use App\Http\Controllers\Controller;
|
2026-04-23 12:43:30 +02:00
|
|
|
use App\Lib\Helpers\GamePeriodHelper;
|
2024-09-06 14:54:26 +02:00
|
|
|
use App\Models\Discount;
|
2024-09-12 10:54:38 +02:00
|
|
|
use App\Models\NewsClub;
|
2024-06-24 15:02:43 +02:00
|
|
|
|
|
|
|
|
class HomeController extends Controller
|
|
|
|
|
{
|
|
|
|
|
/**
|
2024-07-05 10:35:26 +02:00
|
|
|
* Show index page
|
2024-06-24 15:02:43 +02:00
|
|
|
*
|
|
|
|
|
* @return \Illuminate\Contracts\View\View
|
|
|
|
|
*/
|
|
|
|
|
public function index(): \Illuminate\Contracts\View\View
|
|
|
|
|
{
|
2026-05-06 17:11:13 +02:00
|
|
|
$gamePeriodGoldenCrush = GamePeriodHelper::isGamePeriod();
|
2026-05-05 18:16:24 +02:00
|
|
|
$routeNameForGoldenCrush = GamePeriodHelper::routeName();
|
2026-05-06 17:11:13 +02:00
|
|
|
$newsClubModels = NewsClub::getPublishedOrderedByPublishAt();
|
|
|
|
|
$discountModels = Discount::getCachedDiscounts();
|
|
|
|
|
$discountsTotal = $discountModels->sum('value');
|
2024-09-06 14:54:26 +02:00
|
|
|
return (auth('club')->check())
|
2026-05-05 18:16:24 +02:00
|
|
|
? view('club.pages.home.homepage', compact('newsClubModels', 'discountModels', 'discountsTotal', 'gamePeriodGoldenCrush', 'routeNameForGoldenCrush'))
|
2024-09-19 16:38:26 +02:00
|
|
|
: view('club.pages.home.guest', compact('newsClubModels', 'discountsTotal'));
|
2024-06-24 15:02:43 +02:00
|
|
|
}
|
|
|
|
|
}
|