Skip to content

Conversation

tusharnain
Copy link
Contributor

Overview

This PR introduces the __isset() magic method to the Request class, enabling attribute existence checks similar to how __get() retrieves attributes.

Changes

  • Added __isset(string $name): bool method to Request.php.
  • Delegates existence checking to the base request() instance.
/**
 * Determine if an attribute exists on the base request.
 *
 * @param  string  $name
 */
public function __isset($name): bool
{
    return isset(request()->$name);
}

Benefits

  • ✅ Provides a consistent way to check if a request attribute is set.
  • ✅ Improves developer experience when working with dynamic request properties.
  • ✅ Keeps behavior aligned with the existing __get() method.

Notes

  • Backward compatible — no breaking changes introduced.
  • Complements existing request property access patterns.

Copy link

sonarqubecloud bot commented Oct 7, 2025

@yajra yajra merged commit 56e9245 into yajra:master Oct 8, 2025
7 of 8 checks passed
@yajra
Copy link
Owner

yajra commented Oct 8, 2025

🎉 This PR is included in version 12.6.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@yajra yajra added the released label Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants