Laravel Eloquent Multiple Where Condition Example
Hi Guys
In this blog,i will tell you how to create multiple where clause query in laravel. we are exmaple multiple where clause query. you can easy create eloquent multiple where condition using laravel.it will show multiple where in laravel.
it can create multiple where clause query for two then ways available. you will learn multiple where clause query.
There are two way create multiple where clause query in laravel.one way using multiple where clause function using query and second way is single where clause function in array passing.
here blow example of multiple where clause query.
Example 1
here the example multiple where clause function using query.
/**
* Show the application dashboard.
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function index(){
$users = User::where('id','>','2')
->where('birth_date','>','2000-01-01')
->get();
dd($users);
}
Example 2 here the example single where clause function in array passing using query.
/**
* Show the application dashboard.
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function index(){
$posts = \DB::table('posts')
->where([
['category','=','1'],
['view','>','49']
])
->get();
dd($posts);
}
It wil help you..
- How to Notifications With database Driver in Laravel 11?
- How to Send Email Via Notification in Laravel 11?
- How to Install and Configure Laravel 11 Debugbar?
- How to Like Dislike System in Laravel 11?
- How to Paginate a Model with Relationship in Laravel 11?
- Laravel 11 Upload Files to Amazon S3 Example
- Laravel 11 Send WhatsApp Messages Example
- Laravel 11 Rest API Authentication Using JWT Tutorial