Skip to content

Instantly share code, notes, and snippets.

@adamcrampton
Created October 28, 2018 23:22
Show Gist options
  • Save adamcrampton/9198dfdc419996b7b398f07c76bb6d8a to your computer and use it in GitHub Desktop.
Save adamcrampton/9198dfdc419996b7b398f07c76bb6d8a to your computer and use it in GitHub Desktop.
Simple Eloquent search snippet
User::query()
->where('name', 'LIKE', "%{$searchTerm}%")
->orWhere('email', 'LIKE', "%{$searchTerm}%")
->get();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment