PHP Snippet 1:
$results = DB::select('select * from users where id = :id', ['id' => 1]);
PHP Snippet 2:
DB::table('users as u')
->select('id')
->whereRaw('u.id > :id or u.id < :id or u.id = :id', [
'id' => 2,
])
->first();
PHP Snippet 3:
$id = 2;
DB::table('users as u')
->select('id')
->whereRaw('u.id > ? or u.id < ? or u.id = ?', [
$id, $id, $id,
])
->first();
PHP Snippet 4:
$id = 2;
DB::table('users as u')
->select('id')
->whereRaw('u.id > ? or u.id < ? or u.id = ?', array_fill(0, 3, $id))
->first();
PHP Snippet 5:
$id = 2;
DB::table('users')
->select('id')
->where('id', '>', $id)
->orWhere('id', '<', $id)
->orWhere('id', $id)
->first();