クエリのを定義する方法はAS
ありますか?
私は以下を試しました:
$data = News::order_by('news.id', 'desc')
->join('categories', 'news.category_id', '=', 'categories.id')
->left_join('users', 'news.user_id', '=', 'users.id') // ['created_by']
->left_join('users', 'news.modified_by', '=', 'users.id') // ['modified_by']
->paginate(30, array('news.title', 'categories.name as categories', 'users.name as username'));
問題は、['name']
fromカテゴリがからのものに置き換えられることusers
です。それらを異なる名前にする方法はありますか?
上記のエイリアスがある...両方の結合が返されるエイリアスを作成するにはどうすればよいusers.name
ですか?