Compare commits
1 commit
admin-secu
...
migration-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ec00f8835 |
1 changed files with 36 additions and 0 deletions
|
|
@ -67,6 +67,42 @@ trait HasTranslations
|
|||
return parent::mutateAttributeForArray($key, $value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Filter transalations to fetch
|
||||
*
|
||||
* ! Fix of spatie translatable.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param string|null $locale
|
||||
* @param array|null $allowedLocales
|
||||
* @return boolean
|
||||
*/
|
||||
protected function filterTranslations(
|
||||
mixed $value = null,
|
||||
string $locale = null,
|
||||
array $allowedLocales = null
|
||||
): bool {
|
||||
if ($value === null) {
|
||||
// ! Overload this to allow nullable.
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($value === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($allowedLocales === null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!in_array($locale, $allowedLocales)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the model for a bound value.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue