HomeDevCentral

FindableByAttribute trait to find an object by an attribute

Description

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:

  1. Import the correct namespace: use AuthGrove\Services\FindableByAttribute;
  1. 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.

Details

Provenance
derecksonAuthored on
Parents
rGROVE70009780a135: Merge branch 'fix-dropdown-name'
Branches
Unknown
Tags
Unknown