etrepat / baum

Baum is an implementation of the Nested Set pattern for Laravel's Eloquent ORM.
http://etrepat.com/baum
MIT License
2.24k stars 459 forks source link

Concat a table name to avoid error when join query #286

Closed xiaohuilam closed 5 years ago

xiaohuilam commented 6 years ago

If

$me = \App\MyRecommend::where(['agency_id' => auth()->id()])->first();
$recommend_list = $me->descendants()->join('users', 'users.id', '=', 'recommend.user_id', 'left')->select(DB::raw('recommend.*, users.email'))->get();

In currently, baum will throw an exception like this issue: https://github.com/etrepat/baum/issues/285