I am trying to make a relationship and a query but apparently something is wrong because it is not what I am looking for. I'm still starting with laravel and I still have doubts.
My summary tables are the following:
And the data that I want to obtain from the consultations are the following:
If someone can help me, it would be great. Thanks.