For example I have 3 tables:
Table A:
id
name
Table B
id
name
tableA_id
Table C
id
name
tableB_id
and I need to display all data from Table A in table and name from Table C like that:
id | name | TableC name
I can write code for get name of tableC like that:
$data = DB::table('tableA')
->join('tableB','tableB.tableA_id','=','tableA.id')
->join('tableC','tableC.tableB_id','=','tableC.id')
->select('tableA.id','tableA.name','tableC.name')
->get();
But if I want to display more data, what would appropriate solution to solve this without making query huge and seperate it somehow to make it simple to display in blade?