FindableByAttribute trait to find an object by an attribute
Methods implemented
Allows to find an object by a specified attribute:
- findBy($attribute, $value)
e.g. User::findBy('email', 'username@domain.tld');
To use it:
- Import the correct namespace: use AuthGrove\Services\FindableByAttribute;
- Add the trait to your class: use FindableByAttribute;
Compatibility
This trait is intended for Model classes, and use the where<attribute>
Eloquence search capability. It so requires Eloquence or a compatible
ORM implementation.