dwiser
dwiser
FFilament
Created by vahnmarty on 5/7/2024 in #❓┊help
Is there an easy way to transform all labels to a different format instead of ucfirst (default) ?
Have you tried ->label(fn (): string => Str::title('my cool label'))
5 replies
FFilament
Created by KingNii on 4/26/2024 in #❓┊help
Filament Charts
Looks like you need the InteractsWithPageFilters trait. Check out the whole section here https://filamentphp.com/docs/3.x/panels/dashboard#filtering-widget-data
7 replies
FFilament
Created by KingNii on 4/26/2024 in #❓┊help
Filament Charts
You need to provide some of your code.
7 replies
FFilament
Created by johnllobrera on 4/26/2024 in #❓┊help
Plugin Date Range Picker Problem
You're storing a string of two dates into a column that is only accepting one date. You either need to store "04/01/2024 - 04/30/2024" in a string column or separate into a 'period_start' and 'period_end' columns.
4 replies
FFilament
Created by Yurikaso on 4/16/2024 in #❓┊help
Is it possible to use the filament control panel for this?
Creating a second panel shouldn't add much complexity. If you create and register one filament panel, you just do it again for the second panel. https://filamentphp.com/docs/3.x/panels/configuration#creating-a-new-panel The only real complexity in my mind is redirecting the user during the login process but you can override the default Login page to handle that logic. https://filamentphp.com/docs/3.x/panels/users#customizing-the-authentication-features
9 replies
FFilament
Created by Isaaaac on 2/20/2024 in #❓┊help
Reordering Records - Add default sort value when new record is created
Is the new sort number always going to be the highest? I'd consider setting auto increment in the database and letting the database handle it then.
4 replies
FFilament
Created by Arno Bolt on 2/18/2024 in #❓┊help
Livewire table component searchable() / sortable/filter not working
You'll have to explain your situation a bit more but typically you'd use filament resources to create the CRUD pages for you. If you want something separate from the admin panel, you can create a "frontend" panel with a bunch of custom pages.
6 replies
FFilament
Created by Luukd_2000 on 2/19/2024 in #❓┊help
getNavigationBadge on a managerelatedrecords page
Sharing code would be helpful but I think you'd need either $this->getModel()->count() or (new static)->getModel()->count() depending on where you are and what the context is.
6 replies
FFilament
Created by dwiser on 2/16/2024 in #❓┊help
Action button for creating relation on view page
In my case, that doesn't work because I'm not in the context of a form or resource. Filament\Resources\Pages\ViewRecord is being passed through and doesn't have an $ownerRecord property. However, that led to me searching through methods on the ViewRecord page and I found the ->getRecord() method which gets the model for me and can be used in the current context. Working code for my situation is here:
// in App\Filament\App\Resources\ProjectResource\Pages\ViewProject
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make()
->model(Shift::class)
->fillForm(fn (): array => ['project_uuid' => $this->getRecord()->uuid] )
->form(fn (Forms\Form $form) => ShiftResource::form($form)), // Reusing an existing for schema.
];
}
// in App\Filament\App\Resources\ProjectResource\Pages\ViewProject
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make()
->model(Shift::class)
->fillForm(fn (): array => ['project_uuid' => $this->getRecord()->uuid] )
->form(fn (Forms\Form $form) => ShiftResource::form($form)), // Reusing an existing for schema.
];
}
This will give me a button on the view page of a record where I can click to create a new relationship and prefill the ID (uuid) of the current resource.
5 replies
FFilament
Created by dwiser on 2/16/2024 in #❓┊help
Action button for creating relation on view page
I got a little bit closer by filling in the form with static data but I can't seem to pull the record from the ViewRecord page.
Actions\CreateAction::make()
->model(Shift::class)
->fillForm(function () {
// I'm trying to get the model and it's 'uuid' from the View page.
return ['project_uuid' => 'febabc3f-93eb-3ce0-b02b-7013a84ed18c'];
})
->form(fn (Forms\Form $form) => ShiftResource::form($form)),
Actions\CreateAction::make()
->model(Shift::class)
->fillForm(function () {
// I'm trying to get the model and it's 'uuid' from the View page.
return ['project_uuid' => 'febabc3f-93eb-3ce0-b02b-7013a84ed18c'];
})
->form(fn (Forms\Form $form) => ShiftResource::form($form)),
5 replies
FFilament
Created by Arno Bolt on 2/18/2024 in #❓┊help
Livewire table component searchable() / sortable/filter not working
App\Livewire\ListCircuits looks fine as far as I can tell. I don't see @filamentScripts or @filamentStyles in your blade file though. If you're using the full panel install then I'd suggest replacing your welcome.blade.php file with a Filament Resource and generating pages the 'filament' way. https://filamentphp.com/docs/3.x/panels/resources/getting-started
6 replies
FFilament
Created by Wim on 2/18/2024 in #❓┊help
Filament table enum: enum does not exist
Are you looking at v2.x documentation? I don't believe that exists on v3.x tables. In v3.x you have a few options: An Icon Column https://filamentphp.com/docs/3.x/tables/columns/icon#overview A Toggle Column https://filamentphp.com/docs/3.x/tables/columns/toggle#overview Creating an actual Enum class https://filamentphp.com/docs/3.x/support/enums#overview
2 replies
FFilament
Created by Omid on 2/14/2024 in #❓┊help
Good practice to create a route to a PDF download?
It might not be exactly what you're asking for but I've done something similar with just a custom action button:
Tables\Actions\Action::make('download')
->label('Download')
->icon('heroicon-o-arrow-down-tray')
->action(function (Document $record) {
$media = $record->getFirstMedia('documents'); // Using Spatie Media Library

return response() // Laravel response helper
->download( // Docs: https://laravel.com/docs/10.x/responses#file-downloads
$media->getPath(),
$media->name . '.' . $media->extension // Optional. Setting the original filename
);
})
Tables\Actions\Action::make('download')
->label('Download')
->icon('heroicon-o-arrow-down-tray')
->action(function (Document $record) {
$media = $record->getFirstMedia('documents'); // Using Spatie Media Library

return response() // Laravel response helper
->download( // Docs: https://laravel.com/docs/10.x/responses#file-downloads
$media->getPath(),
$media->name . '.' . $media->extension // Optional. Setting the original filename
);
})
3 replies
FFilament
Created by NoxyArg on 2/17/2024 in #❓┊help
Panel custom Url ? like the demo web ?
The path can be configured in the Panel Provider.
6 replies
FFilament
Created by NoxyArg on 2/17/2024 in #❓┊help
Panel custom Url ? like the demo web ?
Are you talking about the hostname or the panel path? https://filamentphp.com/docs/3.x/panels/configuration#changing-the-path
6 replies
FFilament
Created by dwiser on 10/6/2023 in #❓┊help
$set all checked in nested CheckboxList
What was actually getting submitted with the form was a numeric array:
[
0 => 'Bid Request Received',
1 => 'Bid Sent',
2 = > // ...
]
[
0 => 'Bid Request Received',
1 => 'Bid Sent',
2 = > // ...
]
This meant that
$get('notifications .' . $notification->name)
$get('notifications .' . $notification->name)
was not the correct way to set the values and instead it needed to be pushed to the
$get('notifications')
$get('notifications')
array as a numeric array.
5 replies
FFilament
Created by dwiser on 10/6/2023 in #❓┊help
$set all checked in nested CheckboxList
I've already re-written most of the form but in the process I think I figured out the problem. I assumed the CheckboxList would create an associative array:
[
'Bid Request Received',
'Bid Sent',
// ...
]
[
'Bid Request Received',
'Bid Sent',
// ...
]
5 replies
FFilament
Created by dwiser on 10/6/2023 in #❓┊help
$set all checked in nested CheckboxList
Code:
Forms\Components\Section::make()
->schema([
Forms\Components\Toggle::make('projects.' . $project->name)
->onIcon('heroicon-s-shield-check')
->offIcon('heroicon-m-x-mark')
->label($project->label)
->helperText('Enable all Notifications for this project.')
->live(onBlur: true)
->afterStateUpdated(function ($state, Forms\Set $set) use ($project) {
foreach($project->notifications as $notification)
{
// For every notification associated with this Project; Set the checkbox state to match the Toggle state
$set('notifications .' . $notification->name, $state);
}
}),
Forms\Components\Fieldset::make($project->name . 'notifications ')
->label('Notifications')
->schema([
Forms\Components\CheckboxList::make('notifications ')
->label(false)
->options($project->notifications ->pluck('label', 'name'))
->live(onBlur: true)
->afterStateUpdated(function ($state) {
// If any checkbox is unchecked, mark the Toggle as off.
}),
])

])
->columnSpan(1)
Forms\Components\Section::make()
->schema([
Forms\Components\Toggle::make('projects.' . $project->name)
->onIcon('heroicon-s-shield-check')
->offIcon('heroicon-m-x-mark')
->label($project->label)
->helperText('Enable all Notifications for this project.')
->live(onBlur: true)
->afterStateUpdated(function ($state, Forms\Set $set) use ($project) {
foreach($project->notifications as $notification)
{
// For every notification associated with this Project; Set the checkbox state to match the Toggle state
$set('notifications .' . $notification->name, $state);
}
}),
Forms\Components\Fieldset::make($project->name . 'notifications ')
->label('Notifications')
->schema([
Forms\Components\CheckboxList::make('notifications ')
->label(false)
->options($project->notifications ->pluck('label', 'name'))
->live(onBlur: true)
->afterStateUpdated(function ($state) {
// If any checkbox is unchecked, mark the Toggle as off.
}),
])

])
->columnSpan(1)
5 replies