Skip to main content

Laravel query builder multiple where condition

Today, We want to share with you Laravel query builder multiple where condition.In this post we will show you find with where condition in laravel, hear for How to use multiple where condition in Laravel? we will give you demo and example for implement.In this post, we will learn about laravel search query with multiple conditions with an example.

Laravel query builder multiple where condition

There are the Following The simple About Laravel query builder multiple where condition Full Information With Example and source code.

As I will cover this Post with live Working example to develop laravel where multiple values, so the laravel eloquent multiple where array for this example is following below.

Also Read :  PHP Laravel AJAX Request GET and POST Example

Syntex : Multiple Where Clause Query Using Laravel Eloquent

$query->where([
    ['column_1', '=', 'value_1'],
    ['column_2', '<>', 'value_2'],
    [COLUMN, OPERATOR, VALUE],
    ...
])

Simple use multiple OR,AND condition in Laravel queries

Event::where('product_status' , 0)
 ->where(function($q) {
	 $q->where('type', 'private')
	   ->orWhere('type', 'public');
 })
 ->get();

using Eloquent

$events = Event::where('product_status', 0)
    ->whereIn('type', ['public', 'private'])
    ->get();

Laravel get all records from table where two columns are equal

$products = DB::table('products')
->whereColumn([
	['offer_price', '=', 'main_price'],
	['updated_at', '>', 'created_at']
])->get();

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Laravel query builder multiple where condition.
I would like to have feedback on my Pakainfo.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.

Gondaliya Jaydeep

Hi, I’m Jaydeep Gondaliya, PHP developer.Pakainfo.com is the most popular Programming & Web Development blog. Our mission is to provide the best online resources on programming and web development.Any visitors of this site are free to browse our tutorials, live demos, Examples and download scripts.If you have a project that you want to get started, launch quickly, contact me. Email : [email protected]