2
I have linked tables and when I need to access the information I recreate the query:
DB::table('paciente AS pac')
      ->leftJoin('pessoa AS p', 'p.id', '=', 'pac.id_pessoa')
      ->select('p.nome, pac.ficha')
      ->where('pac.id', '=', $id_paciente)
      ->orderby('ag_prof.hora_inicial')
      ->get();
How can I optimize, to avoid the repetition of this part in Controller, I must create in the model or in which folder?