How can I use AS in the following join statement:
User::join('role_user', 'id', '=', 'user_id')
->join('roles', 'role_id', '=', 'roles.id')
->where('roles.name', 'teacher')
->get('roles.name AS roleName') // <-- invalid AS usage just for demonstration
As already mentioned, the problem is, that user.name overrides role.name. How can I modify the above query, so that role.name is renamed to role_name and is preserved in the results?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1W4y90n
via IFTTT
Aucun commentaire:
Enregistrer un commentaire