For getting every new tutorial link Please join our telegram group

part 2 laravel all type of where conditions queries | where(), orWhere(), WhereBetween()

In this post we will discuss all type of where conditions in laravel query builder.some of them where, orWhere, whereBetween, whereNotBetween, whereIn

different type of where conditions

  1. where()
  2. orWhere()
  3. whereBetween()
  4. whereNotBetween()
  5. whereIn()
  6. multiple where conditions

where()

$insert = DB::table('student')->where('id','3')->get();

orWhere()

$insert = DB::table('student')->where('id','3')->orWhere('name','anmol')->get();

whereBetween()

where between method calculate all rows between given range in second parameter.

$insert = DB::table('student')->whereBetween('id', [2,6])->get();

whereIn()

whereIn query builder method take all rows that ids given in array.

$insert = DB::table('student')->whereIn('id', [2,3,6,8])->get();

multiple where conditions

in this example add multiple where conditions by function

$insert = DB::table('student')->whereIn('name', 'anmol')
		->orWhere(function($query){
			$query->where('name','webtut');
			$query->where('id', '<' ,'webtut');
		})->get();

watch all query builder playlist click on sidebar playlist link

php laravel developer anmol sharma

Anmol Sharma

I am a software engineer and have experience in web development technologies like php, Laravel, Codeigniter, javascript, jquery, bootstrap and I like to share my deep knowledge by these blogs.

Related tutorial links