Today, We want to share with you Laravel 6 Eloquent WHERE Like query.In this post we will show you Eloquent WHERE LIKE query escaping with ‘%’ character, hear for Laravel 6 search query with multiple conditions we will give you demo and example for implement.In this post, we will learn about Laravel 6 like query example using eloquent where clause with an example.
Laravel 6 Eloquent WHERE Like query
There are the Following The simple About Where clause query using Laravel 6 Full Information With Example and source code.
As I will cover this Post with live Working example to develop Eloquent WHERE Like query in Laravel 5.8, so the laravel where like case insensitive is used for this example is following below.
Example 1: Laravel-6 ‘LIKE’ using Eloquent
run in the database use dd(DB::getQueryLog())
Ticket::where('email', Input::get('email')) ->orWhere('movie_name', 'like', '%' . Input::get('movie_name') . '%')->get();
Example 2: search query with multiple conditions
Query Builder use Like Query with WHERE Condition.
$tickets = DB::table('tickets')->where('movie_name','LIKE','%'.$movie_name_variable.'%')->get();
Like Query use with Model in WHERE Condition.
$tickets = Ticket::where('movie_name','LIKE','%'.$movie_name_variable.'%')->get();
the value of variable is used in query like
$movie = "good Newss"; $tickets = DB::table('tickets')->where('movie_name','LIKE','%'.$movie.'%')->get();
Example 3: Laravel Query Example:
SQL Example:
SELECT * FROM `tickets` WHERE `movie_name` LIKE '%good Newss%';
Laravel Example
$search = 'good Newss'; $ticket = Ticket::where('movie_name','LIKE',"%{$search}%") ->get(); print_r($ticket);
Web Programming Tutorials Example with Demo
Read :
Summary
You can also read about AngularJS, ASP.NET, VueJs, PHP.
I hope you get an idea about Like Query use in Laravel 6.0.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.