bugfix
Fix error preventing users from deleting their own entires due to timezone issues.
This commit is contained in:
parent
055ffad98e
commit
e7acaa2448
|
|
@ -4,6 +4,7 @@ namespace App\Policies;
|
||||||
|
|
||||||
use App\Models\Entry;
|
use App\Models\Entry;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
use function is_null;
|
use function is_null;
|
||||||
|
|
||||||
|
|
@ -61,11 +62,19 @@ class EntryPolicy
|
||||||
if ($user->is_admin) {
|
if ($user->is_admin) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Return false if $entry->audition->entry_deadline is in the past, continue if not
|
|
||||||
if ($entry->audition->entry_deadline < now()) {
|
// Check entry deadline
|
||||||
|
$currentDate = Carbon::now('America/Chicago');
|
||||||
|
$currentDate = $currentDate->format('Y-m-d');
|
||||||
|
if ($entry->audition->entry_deadline < $currentDate) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OLD VERSION Return false if $entry->audition->entry_deadline is in the past, continue if not
|
||||||
|
// if ($entry->audition->entry_deadline < now()) {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
|
||||||
return $user->school_id == $entry->student->school_id;
|
return $user->school_id == $entry->student->school_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue