From 001f73ddb5090959a9cea3b99187db3db22d1b5d Mon Sep 17 00:00:00 2001 From: Venkata Chandra Sekhar Nainala Date: Mon, 20 Nov 2023 12:01:49 +0100 Subject: [PATCH] fix: study null error fix --- app/Models/Molecule.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Models/Molecule.php b/app/Models/Molecule.php index 1aeec025..748080ec 100644 --- a/app/Models/Molecule.php +++ b/app/Models/Molecule.php @@ -48,7 +48,9 @@ public function studies() $samples = $this->samples->load('study'); $studies = []; foreach ($samples as $sample) { - array_push($studies, $sample->study->id); + if ($sample->study) { + array_push($studies, $sample->study->id); + } } return Study::whereIn('id', $studies);