laravel eloquent or where code example
Example 1: laravel eloquent get first
$user = App\User::where('id',$id)->first();
$userId = App\User::where(...)->pluck('id');
Example 2: eloquent where in
$users = DB::table('users')->whereIn('id', array(1, 2, 3))->get()
Example 3: where () laravel Eloquent
$user = User::where("estado","=",1)->find(10);
Example 4: 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 5: laravel eloquent fill
$flight->fill(['name' => 'Flight 22']);
Example 6: laravel where and where
Table::where('Column', Value)->where('NewColumn', Value)->get();