sql - Laravel list issue -


i have below query directly linked drop down. however, if lists() join() gives

errors: ambiguous 'id'

code:

company::join('users', 'users.company_id', '=', 'companies.id')                     ->distinct()                     ->where('companies.name', 'not like', '%xxxx%')                     ->lists('name', 'id'); 

what solution lists()? real help.

both tables contain id field. solution here prepend table name id field want list. example:

company::join('users', 'users.company_id', '=', 'companies.id')     ->select(         'companies.name companyname',         'companies.id companyid'     )     ->distinct()     ->where('companies.name', 'not like', '%xxxx%')     ->lists('companyname', 'companyid'); 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

How to merge four videos on one screen with ffmpeg -

c - getting error: cannot take the address of an rvalue of type 'int' -