How to add multiple where clauses to Eloquent ORM Laravel?

The hard time here is trying to get specific entries where I need an identifier and a date to match, here is my code:

$testq= DB::table('attendances')->where('user_id', '=', $userinput && 'logon', '=', $newdate)->get(); 
+8
oop php orm eloquent laravel-4
source share
2 answers

Just add more where.

 $testq= DB::table('attendances') ->where('user_id', '=', $userinput) ->where('logon', '=', $newdate) ->get(); 

http://laravel.com/api/4.2/Illuminate/Database/Eloquent/Builder.html#method_where

$ this where (string $ column, string $ operator = null, mixed $ value = null, string $ boolean = 'and')

Add a basic where clause to the request.

+8
source share

As a complement to @sectus answer, you may need this syntax:

 $testq= DB::table('attendances')->whereUserId($userinput) ->whereLogon($newdate) ->get(); 
+5
source share

All Articles