41 lines
787 B
PHP
41 lines
787 B
PHP
<?php
|
|
|
|
namespace App\Actions\Entries;
|
|
|
|
use App\Models\Entry;
|
|
use App\Models\Seat;
|
|
|
|
class GetEntrySeatingResult
|
|
{
|
|
public function __construct()
|
|
{
|
|
}
|
|
|
|
public function __invoke(Entry $entry): string
|
|
{
|
|
return $this->getResult($entry);
|
|
}
|
|
|
|
public function getResult(Entry $entry): string
|
|
{
|
|
if ($entry->hasFlag('no_show')) {
|
|
return 'No Show';
|
|
}
|
|
|
|
if ($entry->hasFlag('declined')) {
|
|
return 'Declined';
|
|
}
|
|
|
|
if ($entry->hasFlag('failed_prelim')) {
|
|
return 'Did not pass prelim';
|
|
}
|
|
|
|
$seat = Seat::where('entry_id', $entry->id)->first();
|
|
if ($seat) {
|
|
return $seat->ensemble->name.' '.$seat->seat;
|
|
}
|
|
|
|
return 'Entry not seated';
|
|
}
|
|
}
|