Файловый менеджер - Редактировать - /home/clickysoft/public_html/somni.clickysoft.net/app/Rules/TenantInvitationCodeRule.php
Назад
<?php namespace App\Rules; use Closure; use Illuminate\Contracts\Validation\ValidationRule; use App\Models\InvitationPropertyUnit; class TenantInvitationCodeRule implements ValidationRule { /** * Run the validation rule. * * @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail */ protected $email; public function __construct($email) { $this->email = $email; } public function validate(string $attribute, mixed $value, Closure $fail): void { $email = $this->email; $invitation = InvitationPropertyUnit::where('invitation_code', request()->input('invitationCode')) ->where('email', $email) ->first(); if (!$invitation) { $fail('The invitation code is invalid or does not match your invited email.'); return; } // Check if the invitation has already been accepted $acceptedInvitations = InvitationPropertyUnit::where('invitation_code', request()->input('invitationCode')) ->where('is_accepted', true) ->get(); if ($acceptedInvitations->isNotEmpty()) { $fail('The invitation code has already been used.'); } } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0.01 |
proxy
|
phpinfo
|
Настройка