Matthew
Matthew
FFilament
Created by Oktobert on 1/6/2025 in #❓┊help
How to format a TextColumn
Can you show us what you tried?
31 replies
FFilament
Created by Oktobert on 1/6/2025 in #❓┊help
How to format a TextColumn
Try this:
use Filament\Tables\Columns\TextColumn;
use Illuminate\Support\HtmlString;

TextColumn::make('description')
->formatStateUsing(fn (string $state) => strip_tags($state))
use Filament\Tables\Columns\TextColumn;
use Illuminate\Support\HtmlString;

TextColumn::make('description')
->formatStateUsing(fn (string $state) => strip_tags($state))
31 replies
FFilament
Created by Oktobert on 1/6/2025 in #❓┊help
How to format a TextColumn
That's weird... how did you use it?
31 replies
FFilament
Created by Matthew on 1/3/2025 in #❓┊help
Filters not returning data in query when using ->multiple()
@Bruno Pereira This is my solution
SelectFilter::make('author_id')
->label(__('filament-latex::filament-latex.column.author.name'))
->default(fn () => Auth::id())
->options(fn () => $userModel::all()->pluck('name', 'id'))
->native(false),
SelectFilter::make('collaborators_id')
->label(__('filament-latex::filament-latex.column.collaborators'))
->default(fn () => [Auth::id()])
->options(fn () => $userModel::all()->pluck('name', 'id'))
->query(function ($query, $data) {
if (! empty($data)) {
// Apply the filter for JSON column
foreach ($data as $id) {
$query->whereJsonContains('collaborators_id', $id);
}
}
})
->multiple()
->native(false),
SelectFilter::make('author_id')
->label(__('filament-latex::filament-latex.column.author.name'))
->default(fn () => Auth::id())
->options(fn () => $userModel::all()->pluck('name', 'id'))
->native(false),
SelectFilter::make('collaborators_id')
->label(__('filament-latex::filament-latex.column.collaborators'))
->default(fn () => [Auth::id()])
->options(fn () => $userModel::all()->pluck('name', 'id'))
->query(function ($query, $data) {
if (! empty($data)) {
// Apply the filter for JSON column
foreach ($data as $id) {
$query->whereJsonContains('collaborators_id', $id);
}
}
})
->multiple()
->native(false),
26 replies
FFilament
Created by Matthew on 1/3/2025 in #❓┊help
Filters not returning data in query when using ->multiple()
And draft wasnt applied as a default value
26 replies
FFilament
Created by Matthew on 1/3/2025 in #❓┊help
Filters not returning data in query when using ->multiple()
I put this in my filters array as a test:
SelectFilter::make('status')
->options([
'draft' => 'Draft',
'reviewing' => 'Reviewing',
'published' => 'Published',
])
->default('draft')
SelectFilter::make('status')
->options([
'draft' => 'Draft',
'reviewing' => 'Reviewing',
'published' => 'Published',
])
->default('draft')
26 replies
FFilament
Created by Matthew on 1/3/2025 in #❓┊help
Filters not returning data in query when using ->multiple()
I have made some progress, however I have a very weird issue, for some reason, no matter what default values wont be applied. For example https://filamentphp.com/docs/3.x/tables/filters/select#applying-select-filters-by-default
26 replies
FFilament
Created by Matthew on 1/3/2025 in #❓┊help
Filters not returning data in query when using ->multiple()
I will ask copilot 😅
26 replies
FFilament
Created by Matthew on 1/3/2025 in #❓┊help
Filters not returning data in query when using ->multiple()
nope :/, still the same
26 replies
FFilament
Created by Matthew on 1/3/2025 in #❓┊help
Filters not returning data in query when using ->multiple()
The issue atm is that I cant set a value as default
26 replies
FFilament
Created by Matthew on 1/3/2025 in #❓┊help
Filters not returning data in query when using ->multiple()
You can check the repo here
26 replies
FFilament
Created by Matthew on 1/3/2025 in #❓┊help
Filters not returning data in query when using ->multiple()
yess
26 replies
FFilament
Created by Matthew on 1/3/2025 in #❓┊help
Filters not returning data in query when using ->multiple()
It definitely has to do with the way Im processing the json data
26 replies
FFilament
Created by Matthew on 1/3/2025 in #❓┊help
Filters not returning data in query when using ->multiple()
ahaha
26 replies
FFilament
Created by Matthew on 1/3/2025 in #❓┊help
Filters not returning data in query when using ->multiple()
@Bruno Pereira no, it doesnt make a difference
26 replies
FFilament
Created by Matthew on 1/3/2025 in #❓┊help
Filters not returning data in query when using ->multiple()
If you want to know more about how Ive set up the collaborators: here
26 replies
FFilament
Created by Matthew on 1/3/2025 in #❓┊help
Filters not returning data in query when using ->multiple()
I should mention, that the collaborators_id column is a json
26 replies
FFilament
Created by Matthew on 1/3/2025 in #❓┊help
Filters not returning data in query when using ->multiple()
SelectFilter::make('collaborators_id')
->default([auth()->id()])
->options(fn () => $userModel::all()->pluck('name', 'id'))
// ->query(fn (Builder $query, $data): Builder => dd($data))
->preload(),
SelectFilter::make('collaborators_id')
->default([auth()->id()])
->options(fn () => $userModel::all()->pluck('name', 'id'))
// ->query(fn (Builder $query, $data): Builder => dd($data))
->preload(),
array_key_exists(): Argument #1 ($key) must be a valid array offset type
26 replies
FFilament
Created by Matthew on 1/3/2025 in #❓┊help
Filters not returning data in query when using ->multiple()
No description
26 replies
FFilament
Created by gemini.dev on 1/2/2025 in #❓┊help
How to add width to TextInputColumn in a table?
Ohhh, thats right.. 1m
9 replies