Simply add an array of condition in where function of laravel Eloquent to create multiple where clause.
Here is an example of multiple where conditions in Laravel.
<?php
$conditions=['condtion1'=>'condition','condtion2'=>'condition','condtion3'=>'condition',......... 'condtionn'=>'condition'];
$results=YourModel::where($conditions)->get();
?>
You can also add conditions like this
$query->where([
['column_1', '=', 'value_1'],
['column_2', '<>', 'value_2'],
[COLUMN, OPERATOR, VALUE],
...
])
This post is submitted by one of our members. You may submit a new post here.
Laravel interview Questions © 2019 - Designed by PSD to HTML