I am working with laravel 5.4 ... I have a question that may be quite simple to answer but I could not find the solution, I have a table state and another called organization to these two unites an intermediate table called state_organization which has the ids of each table plus a field called "note"
It turns out that from the controller I have the following.
$organizacion = Organizacion::findOrFail($id);
$detalle_organizacion = $organizacion->estados()->first()->pivot;
This returns only the first record in the organization that matches the id as follows.
{organizacion_id: 21, estado_id: 1, nota: "nota de serviline limitada prospecto.", created_at: "2018-10-13 00:30:00", updated_at: "2018-10-13 00:30:00"}
so far so good, but it turns out that in the pivot table I have more than one record for each organization as each organization goes through different states leaving notes of why the status change has been updated.
The question is how can I get all the records of an organization?
I have tried using the method all (), pluck (), get () and I have not obtained the result I'm looking for.
I already thank you for your answers.