laravel query builder select code example
Example 1: wherein laravel
DB::table('user')->whereIn('id', [100,200])->get();
Example 2: laravel db::query update
DB::table('user')->where('email', $userEmail)->update(array('member_type' => $plan));
Example 3: query builder laravel
use Illuminate\Database\Eloquent\Builder;
public function scopeFakePersons(Builder $query): Builder
{
return $query->where('is_fake', 1);
}
Example 4: laravel db inserr
$id = DB::table('users')->insertGetId(
['email' => '[email protected]', 'votes' => 0]
);