jeudi 6 septembre 2018

using raw query in where methods makes error in query generation

I gave a eloquent query as

Role::where("(company_id = Auth::user()->company_id or name = 'admin')and id in(2,3)")->pluck('name');

According to my eloquent the sql should be as

select name from roles where ( company_id = 1 or name = admin ) and id IN (2, 3) and roles.deleted_at is null

But it executes as

select name from roles where ( company_id = 1 or name = admin ) and id IN (2, 3) is null and roles.deleted_at is null

can any one help me that why extra is null condition is applied in the query.

Note: I am using soft deletes



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire