From c6c320709eba7c28d1351d149855a7374310508b Mon Sep 17 00:00:00 2001 From: Gil Date: Thu, 14 Jan 2021 20:38:17 +0100 Subject: [PATCH] Fix nested flexible It allows to get the right model when there is nested flexible. --- src/Concerns/HasMediaLibrary.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Concerns/HasMediaLibrary.php b/src/Concerns/HasMediaLibrary.php index 3cc8e10c..1597a84f 100644 --- a/src/Concerns/HasMediaLibrary.php +++ b/src/Concerns/HasMediaLibrary.php @@ -25,7 +25,7 @@ trait HasMediaLibrary { */ protected function getMediaModel() : HasMedia { - $model = Flexible::getOriginModel() ?? $this->model; + $model = Flexible::getOriginModel() ?? $this->model->model ?: $this->model; while ($model instanceof Layout) { $model = $model->getMediaModel();