From babaf7d4bfb4176c75b4084f9033846782ec66af Mon Sep 17 00:00:00 2001 From: Daniil Zobov Date: Fri, 8 Sep 2023 01:21:13 +0300 Subject: [PATCH] Ability to run actions against soft deleted model (#93) --- src/Requests/ActionRequest.php | 5 ++--- src/ResourceRequest.php | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Requests/ActionRequest.php b/src/Requests/ActionRequest.php index 8f10b7a..f8ef971 100644 --- a/src/Requests/ActionRequest.php +++ b/src/Requests/ActionRequest.php @@ -35,10 +35,9 @@ public function models(): Collection $models = collect(); if ($this->has('_models')) { - $models = $this->model()->whereIn( - $this->model()->getKeyName(), + $models = $this->getModelQuery()->findMany( $this->get('_models') - )->get(); + ); } $current = $this->findModel(); diff --git a/src/ResourceRequest.php b/src/ResourceRequest.php index e288d1d..ab2f506 100644 --- a/src/ResourceRequest.php +++ b/src/ResourceRequest.php @@ -153,7 +153,7 @@ public function getModelPaginationList() /** * @return Model */ - private function getModelQuery() + protected function getModelQuery() { $query = $this->resource()->modelQuery($this, $this->model());