auditionadmin/app/Services/EntryService.php

37 lines
645 B
PHP

<?php
namespace App\Services;
use App\Models\Entry;
class EntryService
{
/**
* Create a new class instance.
*/
public function __construct()
{
}
public function isEntryLate(Entry $entry): bool
{
if ($entry->hasFlag('wave_late_fee')) {
return false;
}
return $entry->created_at > $entry->audition->entry_deadline;
}
public function entryExists(Entry $entry): bool
{
static $allEntryIds = null;
if ($allEntryIds === null) {
$allEntryIds = Entry::pluck('id');
}
return $allEntryIds->contains($entry->id);
}
}