Inside the relative database there are two corresponding tables.
- Названия категорий - Списки категорий The output is carried out through the "cattle code"
$cat_name = DB::table('cat_name')->get(); foreach($cat_name as $row) { $child = DB::table('categories')->where('id','=',$row->id)->get(); echo $row->title; foreach($child as $c) { echo $c->title; } } Is it possible to solve the problem of relativity within the controller alone?
DB::table('categories')->leftJoin('categories_parent', 'categories.parent_id', '=', 'categories.id')- VenZell