|string> */ public function rules(): array { return [ 'otp_code' => [ 'required', 'numeric', 'digits:4', Rule::exists('otp_codes', 'code')->where(function ($query) { $query->where('phone', session('login_phone')) ->where('expires_at', '>', now()); }) ] ]; } }