0
Dev, I passed my eloquent to JOIN queries, I was having trouble with duplicate lines in my code I was with more than 500 queries executed, with JOIN reduce to 14 queries, but my problem is a relationship I have.
example:
I have activity the activity is where admin creates the activity for such contributor, so far okay, but the problem is, I have a menu where I can add participant in this activity, "I can add a user to this activity".
Table relacao_aps:
Controller ancient:
$aguardando = Apontamento::with('descricaoAp')->where('kanban_id', 7)->get();
Controller new:
$aguardando = DB::table('apontamentos')
->join('descricao_aps', 'apontamentos.id', '=', 'descricao_aps.apontamentodesc_id')
->join('kanban', 'apontamentos.kanban_id', '=', 'kanban.id')->where('apontamentos.kanban_id', 7)
->join('clientes', 'apontamentos.cliente_id', '=', 'clientes.id')
->leftJoin('users', 'users.id', '=', 'apontamentos.user_id')
->join('relacao_aps', 'relacao_aps.apontamento_id', '=', 'apontamentos.id')
->get();
with the eloquent I did,
@foreach($aguardando as $value1) {{$value1->perfilImagem}}
//responsible
now with participant
@foreach($value1->participante as $item) {{$item->perfilImagem}}
with join:
$aguardando = DB::table('apontamentos')
->join('descricao_aps', 'apontamentos.id', '=', 'descricao_aps.apontamentodesc_id')
->join('kanban', 'apontamentos.kanban_id', '=', 'kanban.id')->where('apontamentos.kanban_id', 7)
->join('clientes', 'apontamentos.cliente_id', '=', 'clientes.id')
->leftJoin('users', 'users.id', '=', 'apontamentos.user_id')
->join('relacao_aps', 'relacao_aps.apontamento_id', '=', 'apontamentos.id')
->get();
how I can show participants that is part of such an activity.