stan errors

This commit is contained in:
nurmuhammet committed 2025-11-02 15:51:37 +05:00
1 parent 6f1de4531e
commit b9007a59a6
2 files changed
+8 -6

No files matched your search

@@ -13,7 +13,6 @@
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Components\Fieldset;
use Filament\Schemas\Components\FusedGroup;
+8 -5
View File
@@ -42,18 +42,21 @@ public function boot(): void
* @return \Illuminate\Database\Eloquent\Builder
*/
Builder::macro('orderByTranslation', function (string $field, string $order = 'asc', ?string $locale = null) {
/** @var \Illuminate\Database\Eloquent\Builder */
$builder = $this; // @phpstan-ignore-line
if (
in_array(HasTranslations::class, class_uses($this->model))
&& in_array($field, $this->model->translatable)
in_array(HasTranslations::class, class_uses($builder->model)) // @phpstan-ignore-line
&& in_array($field, $builder->model->translatable)
&& config('database.default') === 'pgsql'
) {
$locale = $locale ?? app()->getLocale();
$this->query->orderByRaw("$field->>'$locale' $order");
$builder->query->orderByRaw("$field->>'$locale' $order");
} else {
$this->query->orderBy($field, $order);
$builder->query->orderBy($field, $order);
}
return $this;
return $builder;
});
}
}