From 18a78ae2148fdeadae171ecde04d6d61799be7c6 Mon Sep 17 00:00:00 2001 From: nikuscs Date: Fri, 25 Nov 2022 20:31:18 +0000 Subject: [PATCH] Fix styling --- src/Core/Option/Option.php | 9 +++++---- src/Datatables/Actions/Concerns/CanRefresh.php | 1 + src/Datatables/Http/Payload/Concerns/HasModels.php | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Core/Option/Option.php b/src/Core/Option/Option.php index 6cc9c5f..7e3f21e 100644 --- a/src/Core/Option/Option.php +++ b/src/Core/Option/Option.php @@ -58,13 +58,14 @@ public function toArray(): array $this->disabledKey => $this->isDisabled(), $this->childrenKey => $this->getChildrenToArray(), ]) - ->filter(function ($value,$key) { - if($key === $this->childrenKey) { - return !empty($value); + ->filter(function ($value, $key) { + if ($key === $this->childrenKey) { + return ! empty($value); } - if($key === $this->disabledKey && $value === false) { + if ($key === $this->disabledKey && $value === false) { return false; } + return true; }) ->toArray(); diff --git a/src/Datatables/Actions/Concerns/CanRefresh.php b/src/Datatables/Actions/Concerns/CanRefresh.php index 41defb5..c8636a2 100644 --- a/src/Datatables/Actions/Concerns/CanRefresh.php +++ b/src/Datatables/Actions/Concerns/CanRefresh.php @@ -10,6 +10,7 @@ trait CanRefresh public function refreshAfterExecuted(bool | Closure $refresh = false): static { $this->after['refresh'] = $this->evaluate($refresh); + return $this; } diff --git a/src/Datatables/Http/Payload/Concerns/HasModels.php b/src/Datatables/Http/Payload/Concerns/HasModels.php index fcb6fa1..e213003 100644 --- a/src/Datatables/Http/Payload/Concerns/HasModels.php +++ b/src/Datatables/Http/Payload/Concerns/HasModels.php @@ -37,7 +37,7 @@ public function resolveModels(): void throw_if(empty($primaryKey), new DatatableUnableToResolveModelPrimaryKeyException()); // Not all selected and not selected rows at all - if(!$this->isAllSelected() && !$this->hasSelectedRows()) { + if (! $this->isAllSelected() && ! $this->hasSelectedRows()) { return; } @@ -46,7 +46,7 @@ public function resolveModels(): void $this ->getQuery() ->clone() - ->when(!$this->isAllSelected(), fn($query) => $query->whereIn($primaryKey, $this->getSelectedRowsIds())) + ->when(! $this->isAllSelected(), fn ($query) => $query->whereIn($primaryKey, $this->getSelectedRowsIds())) ->get() ?? Collection::make() ); }