Skip to content

Instantly share code, notes, and snippets.

@er-pkumar
Last active May 7, 2024 06:11
Show Gist options
  • Save er-pkumar/501b5f0290b93f77b5d064dcc8136add to your computer and use it in GitHub Desktop.
Save er-pkumar/501b5f0290b93f77b5d064dcc8136add to your computer and use it in GitHub Desktop.
Laravel way to search across multiple column in table
$searchString = $request->validated('keyword');
$user = User::whereAny(
    [
        'first_name',
        'last_name',
        'email'
    ],
    'ilike',
    "{$searchString}%"
)->get();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment