From 51e83d8703049b2eb2d82c348616c4440bf12f56 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Sun, 18 Apr 2021 23:55:36 +0800 Subject: [PATCH] Support serializing relation. Signed-off-by: Mior Muhammad Zaki --- composer.json | 2 +- src/Actions/QueuedExport.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 3a162cb..b2c617e 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "require": { "php": ">=7.1.0", "laravel/nova": "*", - "laravie/serialize-queries": "^0.2", + "laravie/serialize-queries": "^0.3", "maatwebsite/excel": "^3.1" }, "autoload": { diff --git a/src/Actions/QueuedExport.php b/src/Actions/QueuedExport.php index 1b3b6ef..221efb0 100644 --- a/src/Actions/QueuedExport.php +++ b/src/Actions/QueuedExport.php @@ -4,6 +4,7 @@ use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Database\Eloquent\Builder as QueryBuilder; +use Illuminate\Database\Eloquent\Relations\Relation; use Laravel\Nova\Nova; use Laravie\SerializesQuery\Eloquent; use Maatwebsite\LaravelNovaExcel\Requests\SerializedRequest; @@ -24,7 +25,7 @@ public function __sleep() $this->request = SerializedRequest::serialize($this->request); } - if ($this->query instanceof QueryBuilder) { + if ($this->query instanceof QueryBuilder || $this->query instanceof Relation) { $this->query = Eloquent::serialize($this->query); }