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

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -