How to get the desire output using laravel query. Tried that way does not get success please guide thanks a lot in advance
Is there any way we can set it in model if possible please guide
User
id name b_id
1 Alax 1,3
2 Rex 2,4
3 Lex 2,3
Books
id book_name book_author
1 Javascript jim
2 PHP json
3 LARAVEL rax
4 SYMPHONY Alax
Output
id name b_id
1 Alax Javascript, LARAVEL
2 Rex PHP, SYMPHONY
3 Lex PHP, LARAVEL
And Query:
$res = DB::table('user')->leftJoin('book', function($join){
$join->on(DB::raw("find_in_set(book.id, user.b_id)",DB::raw(''),DB::raw('')));
});