10.April 2026
This commit is contained in:
parent
a00c42e770
commit
f58c709945
208 changed files with 19280 additions and 2914 deletions
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\DashboardNews;
|
||||
use App\Models\Incentive;
|
||||
use App\Models\IncentiveParticipant;
|
||||
use App\Models\ShoppingPayment;
|
||||
use App\User;
|
||||
use Carbon\Carbon;
|
||||
|
|
@ -20,6 +23,7 @@ class HomeController extends Controller
|
|||
|
||||
public function index()
|
||||
{
|
||||
|
||||
if (! Auth::check()) {
|
||||
return redirect('login');
|
||||
}
|
||||
|
|
@ -43,10 +47,26 @@ class HomeController extends Controller
|
|||
return redirect('login');
|
||||
}
|
||||
|
||||
$user = Auth::user();
|
||||
|
||||
$activeIncentive = null;
|
||||
$incentiveParticipant = null;
|
||||
|
||||
if ($user->isActiveAccount()) {
|
||||
$activeIncentive = Incentive::active()->first();
|
||||
if ($activeIncentive) {
|
||||
$incentiveParticipant = IncentiveParticipant::where('incentive_id', $activeIncentive->id)
|
||||
->where('user_id', $user->id)
|
||||
->first();
|
||||
}
|
||||
}
|
||||
|
||||
$data = [
|
||||
'user' => Auth::user(),
|
||||
'user' => $user,
|
||||
'now' => Carbon::now(),
|
||||
'dashboardNews' => \App\Models\DashboardNews::getActiveNews(),
|
||||
'dashboardNews' => DashboardNews::getActiveNews(),
|
||||
'activeIncentive' => $activeIncentive,
|
||||
'incentiveParticipant' => $incentiveParticipant,
|
||||
];
|
||||
|
||||
return view('home', $data);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue