Laravel Like Query Using Eloquent Where Clause


In This Tutorial, We Learn Whenever you require to use select like query in your application then you can easily use. Laravel 7 provides a query builder and MySQL like condition is very simple to use. the like query is used in where condition.

SQL Example:
SELECT *
FROM `users`
WHERE `name` LIKE '%student%';
Laravel Query Example:
$search = 'student';
$user = User::where('name','LIKE',"%{$search}%")
              ->get();
print_r($user);

I hope it can help you...

Leave a Reply

Your privacy will not be published. Required fields are marked *

We'll share your Website Only Trusted.!!