auditionadmin/app/Http/Controllers/Tabulation/DoublerDecisionController.php

41 lines
984 B
PHP

<?php
namespace App\Http\Controllers\Tabulation;
use App\Http\Controllers\Controller;
use App\Models\Entry;
use App\Models\EntryFlag;
use App\Services\DoublerService;
class DoublerDecisionController extends Controller
{
protected $doublerService;
public function __construct(DoublerService $doublerService)
{
$this->doublerService = $doublerService;
}
public function accept(Entry $entry)
{
//
}
public function decline(Entry $entry)
{
if ($entry->hasFlag('declined')) {
return redirect()->back()->with('caution', 'Entry is already declined');
}
EntryFlag::create([
'entry_id' => $entry->id,
'flag_name' => 'declined',
]);
$this->doublerService->refreshDoublerCache();
$returnMessage = $entry->student->full_name().' declined seating in '.$entry->audition->name;
return redirect()->back()->with('success', $returnMessage);
}
}