Skip to content

Commit

Permalink
fix: study null error fix
Browse files Browse the repository at this point in the history
  • Loading branch information
CS76 committed Nov 20, 2023
1 parent fa5fd88 commit 001f73d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/Models/Molecule.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 001f73d

Please # to comment.