jake balba jake balba - 1 year ago 114
PHP Question

How to add multiple where clause on Eloquent ORM Laravel?

Having a hard time here trying to retrieve specific records where I need the ID and the Date to match, here is my code:

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

Answer Source

Just add one more where.

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


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

Add a basic where clause to the query.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download