filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
16.23k stars 2.58k forks source link

why formatStateUsing doesn't work in some cases? #12322

Closed Mahmoudreda66 closed 3 months ago

Mahmoudreda66 commented 3 months ago

Package

filament/filament

Package Version

^3.2

Laravel Version

^10.10

Livewire Version

No response

PHP Version

^8.1

Problem description

i use formatStateUsing method in some of my tables, it works for some columns and don't invoke in others like:

it works and invokes here: Tables\Columns\TextColumn::make('status') ->formatStateUsing(fn (Order $order) => $order->deadline ?? 'Not Exists') ->label('الحالة') ->searchable()

and it doesn't work here:

Tables\Columns\TextColumn::make('deadline') ->label('وقت الانتهاء') ->formatStateUsing(fn (Order $order) => $order->deadline ?? 'Not Exists') ->dateTime() ->sortable()

Tables\Columns\TextColumn::make('branch.name') ->formatStateUsing(fn (Order $order) => $order->deadline ?? 'Not Exists') ->numeric() ->sortable()

      why?

Expected behavior

to work in all columns

Steps to reproduce

use same code

Reproduction repository

https://github.com/Mahmoudreda66/customer-support

Relevant log output

No response

github-actions[bot] commented 3 months ago

Hey @Mahmoudreda66! We're sorry to hear that you've hit this issue. 💛

However, it looks like you forgot to fill in the reproduction repository URL. Can you edit your original post and then we'll look at your issue?

We need a public GitHub repository which contains a Laravel app with the minimal amount of Filament code to reproduce the problem. Please do not link to your actual project, what we need instead is a minimal reproduction in a fresh project without any unnecessary code. This means it doesn't matter if your real project is private / confidential, since we want a link to a separate, isolated reproduction. That would allow us to download it and review your bug much easier, so it can be fixed quicker. Please make sure to include a database seeder with everything we need to set the app up quickly.

Also, it doesn't look like you've provided much information on how to replicate the issue. Please edit your original post with clear steps we need to take.