laravel query builder where code example

Example 1: wherein laravel

DB::table('user')->whereIn('id', [100,200])->get();

Example 2: laravel wher in

$users = DB::table('users')
                    ->whereIn('id', [1, 2, 3])
                    ->get();

Example 3: laravel db::query update

DB::table('user')->where('email', $userEmail)->update(array('member_type' => $plan));

Example 4: Laravel query where and

Table::where('Column', Value)->where('NewColumn', Value)->get();

Example 5: laravel query builder select first

$user = DB::table('users')->where('name', 'John')->first();

var_dump($user->name);

Example 6: laravel where

$users = DB::table('users')
                ->whereMonth('created_at', '12')
                ->get();

Tags:

Php Example