vendredi 10 juillet 2020

laravel join gives wrong id

I have the following query:

\DB::table('Service_prices')
                        ->join('Services', 'Services.id', 'Service_prices.service_id')
                        ->join('Roles', 'Roles.id', 'Service_prices.id')
                        ->join('Users', 'Users.role_id', 'Roles.id')
                        ->where('Services.id', $service_id)
                        ->select(['Service_prices.id as service_price_id', 'Roles.id as role_id', 'Service_id as service_id'])
                        ->get();

the issue is that all tables has id and I need them all, but, I get same id for all, in other words it appears there is some conflict and one of the ids are overwriting the others. how to solve this?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/326xbK4
via IFTTT

Aucun commentaire:

Enregistrer un commentaire