Then it's a front problem and not a back one. Show your front code.
Jun 16, 2023
7
Level 2
Show child records - Inertia/ReactJS
I have a "show" page that displays details of a record, from the show() method in the controller. When I try to retrieve the child records in a table, I get a blank section. There's no error in the console. However, when I console.log(records) the data, I get the result. But the component cannot display.
use Inertia\Response as InertiaResponse;
use App\Models\Record;
use App\Models\Patient;
public function show(Patient $patient): InertiaResponse
{
return inertia('Patients/Details', [
'records' => Record::query()->where('patient_id', $patient->id)->get([fields here]),
]);
}
I don't know whether I am supposed to write the eloquent model differently because I think that query should work since the data can display in the console.
Please or to participate in this conversation.