search_result BookTask join book_sections_index book_sections_index se

1
2
3
4
5
6
7
$search_result = BookTask::join('book_sections_index', 'book_sections_index.section_id', '=', 'book_tasks.section_id')
->where('book_sections_index.parent_id', '=', $root_parent)
->where(function($query) use ($search){
$query->where('book_tasks.content', 'LIKE', '%' . $search . '%')
->orWhere('book_tasks.title', 'LIKE', '%' . $search . '%');
})
->get();