N
N
Nikidze2020-06-22 14:18:34
Laravel
Nikidze, 2020-06-22 14:18:34

How to search across multiple fields in laravel?

WHERE `name` = 'Вася' AND `lastname` = 'Иванов'
or
WHERE `name` = 'Вася' OR`lastname` = 'Иванов'
How to write such queries using laravel?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Gleb Starkov, 2020-06-22
@colonel

...->where('name', 'Вася')->where('lastname', 'Иванов');

...->where('name', 'Вася')->orWhere('lastname', 'Иванов');

What's stopping you from reading the documentation?
https://laravel.com/docs/7.x/queries#where-clauses

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question