You've already forked Atomcms-edit
29 lines
764 B
PHP
Executable File
29 lines
764 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\RadioGiveaway;
|
|
use Illuminate\Http\RedirectResponse;
|
|
use Illuminate\View\View;
|
|
|
|
class RadioGiveawayController extends Controller
|
|
{
|
|
public function index(): View
|
|
{
|
|
$giveaways = RadioGiveaway::where('is_active', true)
|
|
->orderBy('starts_at', 'desc')
|
|
->get();
|
|
|
|
return view('community.radio.giveaways.index', ['giveaways' => $giveaways]);
|
|
}
|
|
|
|
public function show(RadioGiveaway $giveaway): View|RedirectResponse
|
|
{
|
|
if (! $giveaway->is_active) {
|
|
return redirect()->route('radio.giveaways.index')->with('error', __('radio.not_active'));
|
|
}
|
|
|
|
return view('community.radio.giveaways.show', ['giveaway' => $giveaway]);
|
|
}
|
|
}
|