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

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -