Laravel Like Query Example using Eloquent Where Clause

About Us:

We are from free coder. We are a group of web developers who are passionate about web development. You can learn from us php, laravel, node js, vue js, react js and many other topic on web developement.
we are very happy to help you.
free coder

Today what you are going to learn:

Whenever you require to use select like query in your application then you can easily use. Laravel 5 provide query builder and mysql like condition is very simple to use. So let's see bellow lesson did convert bellow sql query.

SQL Example:

SELECT *

FROM `users`

WHERE `name` LIKE '%hdtopi%';

Laravel Query Example:

$search = 'hdtopi';

$user = User::where('name','LIKE',"%{$search}%")

->get();

print_r($user);

Recent Posts

Related Posts