2020-11-04 11:49:43 +01:00
|
|
|
<?php
|
|
|
|
|
|
2022-01-10 14:02:25 +01:00
|
|
|
namespace App\Http\Controllers\Bo;
|
2020-11-04 11:49:43 +01:00
|
|
|
|
|
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
|
use App\Models\Participation;
|
|
|
|
|
use App\Models\Settings;
|
2023-12-05 12:33:25 +01:00
|
|
|
use Illuminate\Contracts\View\View;
|
2020-11-04 11:49:43 +01:00
|
|
|
|
2023-12-05 12:33:25 +01:00
|
|
|
class ParticipationController extends Controller
|
2020-11-04 11:49:43 +01:00
|
|
|
{
|
2023-08-23 10:38:11 +00:00
|
|
|
/**
|
2023-12-05 12:33:25 +01:00
|
|
|
* Create the controller instance.
|
|
|
|
|
*/
|
|
|
|
|
public function __construct()
|
|
|
|
|
{
|
|
|
|
|
$this->authorizeResource(Participation::class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* View all winners
|
2023-08-23 10:38:11 +00:00
|
|
|
*
|
|
|
|
|
* @return \Illuminate\Contracts\View\View
|
|
|
|
|
*/
|
2023-12-05 12:33:25 +01:00
|
|
|
public function viewWinnerList(): View
|
2021-08-18 17:08:02 +02:00
|
|
|
{
|
2023-12-05 12:33:25 +01:00
|
|
|
$this->authorize('viewWinnerList', Participation::class);
|
|
|
|
|
|
2023-08-23 10:38:11 +00:00
|
|
|
/** @var \Illuminate\Database\Eloquent\Builder $rangeModels */
|
2023-12-05 12:33:25 +01:00
|
|
|
$participationModels = Participation::query()->whereHas('instantWin');
|
2020-11-20 15:18:31 +01:00
|
|
|
|
2023-08-23 10:38:11 +00:00
|
|
|
/** Sort columns with a query */
|
|
|
|
|
$this->sortQuery($participationModels);
|
2021-02-23 18:27:03 +01:00
|
|
|
|
2023-08-23 10:38:11 +00:00
|
|
|
/** Custom pagination */
|
2023-11-23 17:31:28 +01:00
|
|
|
$participationModels = $this->paginate($participationModels);
|
2020-11-20 15:18:31 +01:00
|
|
|
|
2023-12-01 15:43:00 +01:00
|
|
|
/** @var \App\Models\Settings */
|
|
|
|
|
$settings = app(Settings::class);
|
2021-02-23 18:27:03 +01:00
|
|
|
|
2023-11-20 17:22:24 +01:00
|
|
|
return view('back::pages.winners-list.index', compact(
|
2023-08-23 10:38:11 +00:00
|
|
|
'participationModels',
|
|
|
|
|
'settings'
|
|
|
|
|
));
|
2020-11-20 15:18:31 +01:00
|
|
|
}
|
2020-11-04 11:49:43 +01:00
|
|
|
}
|