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
Post a Comment