From dae019aa8f833f5663bc6d770458cd3cb53536bf Mon Sep 17 00:00:00 2001 From: Ramiz Kongulov <33090344+kongulov@users.noreply.github.com> Date: Mon, 1 Feb 2021 11:49:06 +0400 Subject: [PATCH] Support Nova authorizedToSee method --- src/NovaTabTranslatable.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/NovaTabTranslatable.php b/src/NovaTabTranslatable.php index 9221fcf..d997626 100644 --- a/src/NovaTabTranslatable.php +++ b/src/NovaTabTranslatable.php @@ -71,10 +71,12 @@ protected function createTranslatableFields() collect($this->locales) ->crossJoin($this->originalFields) ->eachSpread(function (string $locale, Field $field) { - $translatedField = $this->createTranslatedField($field, $locale); + if($field->authorizedToSee(request())) { + $translatedField = $this->createTranslatedField($field, $locale); - $this->data[] = $translatedField; - $this->translatedFieldsByLocale[$locale][] = $translatedField; + $this->data[] = $translatedField; + $this->translatedFieldsByLocale[$locale][] = $translatedField; + } }); }