Laravel 5.1: handle joins with same column names

前端 未结 4 1861
傲寒
傲寒 2021-02-04 00:00

I\'m trying to fetch following things from the database:

  • user name
  • user avatar_name
  • user avatar_filetype
  • complete conversation_messages<
4条回答
  •  生来不讨喜
    2021-02-04 00:39

    Yeah, simply rename the column on either table and it should work. Also what you can do is, rename the user.name column to anything, also rename sender column of conversation_messages to id and perform a natural join.

提交回复
热议问题