where and in laravel code example
Example 1: laravel orWhere
$camps = $field->camps()->where('status', 0)->where(function ($q) {
$q->where('sex', Auth::user()->sex)->orWhere('sex', 0);
})->get();
Example 2: laravel where
$users = DB::table('users')
->whereMonth('created_at', '12')
->get();
Example 3: or where in orm laravel
$a='foo', $b='bar', $c='john', $d='doe';
Coder::where(function ($query) use ($a, $b) {
$query->where('a', '=', $a)
->orWhere('b', '=', $b);
})->where(function ($query) use ($c, $d) {
$query->where('c', '=', $c)
->orWhere('d', '=', $d);
})->get();
Example 4: laravel where
$users = DB::table('users')
->whereDate('created_at', '2016-12-31')
->get();
Example 5: laravel where and where
Table::where('Column', Value)->where('NewColumn', Value)->get();