Ron
Ron
FFilament
Created by jagato0 on 3/21/2024 in #❓┊help
Cant download xlsx in vapor through Export action
@bwurtz999 @Stefano Thanks for the investigation here. I was able to get this to work , but maybe not in the cleanest way but I can live with it to have the functionality. 1. Make a derivative copy of XlsxDownloader to my App namespace I copied \Filament\Actions\Exports\Downloaders\XlsxDownloader.php to App\Filament\Actions\Exports\Downloaders\XlsxDownloader.php 2. Setup AppServiceProvider Bindings
$this->app->bind(XlsxDownloader::class, function () {
return new \App\Filament\Actions\Exports\Downloaders\XlsxDownloader;
});
$this->app->bind(XlsxDownloader::class, function () {
return new \App\Filament\Actions\Exports\Downloaders\XlsxDownloader;
});
3. Set the header on the download call from the storage disk
if ($disk->exists($filePath = $directory.DIRECTORY_SEPARATOR.$fileName)) {

return $disk->download(path: $filePath, name: null, headers: [
'X-Vapor-Base64-Encode' => 'True',
]);
}
if ($disk->exists($filePath = $directory.DIRECTORY_SEPARATOR.$fileName)) {

return $disk->download(path: $filePath, name: null, headers: [
'X-Vapor-Base64-Encode' => 'True',
]);
}
8 replies
FFilament
Created by Neamix on 8/17/2024 in #❓┊help
Customize Reset password page
You can pass your own page class to any of the authentication features; https://filamentphp.com/docs/3.x/panels/users#authentication-features
return $panel
// ...
->passwordReset(YourPasswordReset::class)

return $panel
// ...
->passwordReset(YourPasswordReset::class)

3 replies
FFilament
Created by lmtc on 8/5/2024 in #❓┊help
Submitting form from Section header action
@lmtc this looks like a reasonable approach. I am not sure exactly what is happening with the config value array , but if you want all the config value key/value pairs to be editable , you can fill the form with existing data https://filamentphp.com/docs/3.x/actions/modals#filling-the-form-with-existing-data and then use a simpler Config::updateOrCreate() if 'config_type" is unique for the Config model
5 replies
FFilament
Created by hrvzmndz on 8/8/2024 in #❓┊help
Time Difference
You could use https://filamentphp.com/docs/3.x/tables/columns/getting-started#calculated-state or simply define an accessor in your model and add a text column for the time difference (e.g. Add this to your model)

public function timeDiff(): Attribute {
return Attribute::get(fn() => $this->time_in->diffForHumans($this->time_out, CarbonInterface::DIFF_ABSOLUTE));
}

public function timeDiff(): Attribute {
return Attribute::get(fn() => $this->time_in->diffForHumans($this->time_out, CarbonInterface::DIFF_ABSOLUTE));
}
3 replies
FFilament
Created by lmtc on 8/5/2024 in #❓┊help
Submitting form from Section header action
$record will be null on create. If you want to submit the form on both create and edit use $context
->action(function (array $data, Config $record, string $context) {
if ($context === 'edit') {
$record->fill($data);
$record->save();
}
if ($context === 'create') {
Config::create($data);
}
})
->action(function (array $data, Config $record, string $context) {
if ($context === 'edit') {
$record->fill($data);
$record->save();
}
if ($context === 'create') {
Config::create($data);
}
})
5 replies
FFilament
Created by mylanconnolly on 7/24/2024 in #❓┊help
Encountering poor performance in production after a number of troubleshooting steps
I did deploy the demo app to forge with opcache, all performance optimizations, and saw similar results as Laravel Vapor. I ran an AWS t4g-large instance with on-box mySQL. Forge has an opcache button to enable at the server level and default gzip compression. Not seeing a cost-effective deployment solution to get to the 250ms load times seen on my dev system.
8 replies
FFilament
Created by mylanconnolly on 7/24/2024 in #❓┊help
Encountering poor performance in production after a number of troubleshooting steps
I deploy to Laravel Vapor and see similar differences between my Mac Studio (Apple M2 Max Chip, 32GB). To be able to analyze this a little better, tonight I deployed the filament demo app to laravel vapor to compare performance to the two production apps (demo.filamentphp.com). The vapor deployment is similar in performance (roughly 350ms - 800ms load times). I was able to correct a couple things with Laravel Vapor to improve the network throughput but not the overall PHP load time. Turns out with Vapor at least that assets loaded from the root domain aren't cached. So I had to publish the livewire assets to get the livewire.min.js to cache. Next, I had to enable content encoding at the AWS API Gateway for compression which resulted in 70-80% compression the response html. I plan to deploy this to forge and compare performance across a couple AWS instance types.
8 replies
FFilament
Created by Atreides on 7/23/2024 in #❓┊help
Trigger Wizard next step via Action
Check out this message thread, It may be what you are looking for: https://discord.com/channels/883083792112300104/1255861903100739667/1255861903100739667
3 replies
FFilament
Created by IWBW on 7/10/2024 in #❓┊help
Customise cluster sub-menu
No description
6 replies
FFilament
Created by Ron on 7/10/2024 in #❓┊help
reload a Livewire form component after updating the record
That worked.
...
->action(function (array $data, Order $record, Component $livewire) {
$record->recommendation->update([
'recommendation' => $data['override_recommendation'],
]);
$livewire->dispatch('recommendation-updated'):
}
...
->action(function (array $data, Order $record, Component $livewire) {
$record->recommendation->update([
'recommendation' => $data['override_recommendation'],
]);
$livewire->dispatch('recommendation-updated'):
}
In my Livewire component class used in the Livewire::make() call in my form,
#[On('recommendation-updated')]
public function updateRecommendation(): void
{
$this->record = $this->record->refresh()->load('recommendation.reasons');
}

public function recommendationInfolist(Infolist $infolist): Infolist
{

return $infolist
->record($this->record)
->schema([
$this->getReasonsRepeatableEntry(),
]);
}
#[On('recommendation-updated')]
public function updateRecommendation(): void
{
$this->record = $this->record->refresh()->load('recommendation.reasons');
}

public function recommendationInfolist(Infolist $infolist): Infolist
{

return $infolist
->record($this->record)
->schema([
$this->getReasonsRepeatableEntry(),
]);
}
dispatching the update updates the record for the infolist and the infolist is rendered with the changes from the modal form on the action. Thanks again. I spent way too much time on this! I appreciate it very much.
8 replies
FFilament
Created by Ron on 7/10/2024 in #❓┊help
reload a Livewire form component after updating the record
Thank you for your help!
8 replies
FFilament
Created by Ron on 7/10/2024 in #❓┊help
reload a Livewire form component after updating the record
I will try that
8 replies
FFilament
Created by Ron on 7/10/2024 in #❓┊help
reload a Livewire form component after updating the record
It seems as though I need to dispatch an event to my livewire component, and i can find the livewire form component via
->action(function (array $data, Order $record, Component $livewire) {
$component = $livewire->form->getComponent('view-applicant-recommendation');

}
->action(function (array $data, Order $record, Component $livewire) {
$component = $livewire->form->getComponent('view-applicant-recommendation');

}
where this is the form schema
->schema([
Livewire::make(ViewApplicantRecommendation::class)
->key('view-applicant-recommendation'),
])
->schema([
Livewire::make(ViewApplicantRecommendation::class)
->key('view-applicant-recommendation'),
])
But once I have the Livewire form component, I can't see how to get to the actual ViewApplicantRecommendation component. I looked at the code for Filament\Forms\Components\Livewire but didn't see anything obvious on how to get an instance of the Livewire component passed in the make() method
8 replies
FFilament
Created by Ron on 7/6/2024 in #❓┊help
How to test Header/Footer Actions in a Section Form Component
I was able to solve this with a change to the key string used with the Section form component. In my case i was rendering the form from a custom page with a "data" statePath. When using the livewire test helper function "callFormComponentAction" , the code is looking for the component using the statePath and the key name. Custom page form function
public function form(Form $form): Form
{
return $form->schema([
...
])
->model($this->record)
->statePath('data')
->operation('edit');
}
public function form(Form $form): Form
{
return $form->schema([
...
])
->model($this->record)
->statePath('data')
->operation('edit');
}
I was able to call the Header Action in a Section by prefixing the key with the state path in the schema but using the non-state path key in the test.
Section::make('Rental History')
->key('data.rental-history')
->headerActions([
...
])
->schema([
...
]),
Section::make('Rental History')
->key('data.rental-history')
->headerActions([
...
])
->schema([
...
]),
Test Code
livewire(OrderRentalHistory::class, ['record' => $order->id])
->callFormComponentAction('rental-history', 'edit-form')
livewire(OrderRentalHistory::class, ['record' => $order->id])
->callFormComponentAction('rental-history', 'edit-form')
2 replies
FFilament
Created by adnn on 7/2/2024 in #❓┊help
Split a Resource Form in multiple sub navigations?
@adnn happy to help. Let me know if you get stuck or have questions. I am using Filament as the entire app, not just admin and have found it really provides for about every use case I can throw at it. For learning custom pages and form handling, i referenced this repo: https://github.com/andrewdwallo/erpsaas from @Andrew Wallo which is a great learning resource.
6 replies
FFilament
Created by Alexandre on 6/13/2024 in #❓┊help
Component not found on select with native(false) and searchable()
One workaround for issue #11289 is to handle disabled of the select with CSS instead of filament disable() I added these 2 entries to my theme.css
.disabled .choices {
@apply bg-gray-100 dark:bg-gray-700 opacity-75 cursor-not-allowed pointer-events-none !important;
}

.disabled:first-child {
@apply bg-gray-100 dark:bg-gray-700 opacity-75 cursor-not-allowed pointer-events-none !important;
}
.disabled .choices {
@apply bg-gray-100 dark:bg-gray-700 opacity-75 cursor-not-allowed pointer-events-none !important;
}

.disabled:first-child {
@apply bg-gray-100 dark:bg-gray-700 opacity-75 cursor-not-allowed pointer-events-none !important;
}
Then instead of disabled, i used extraAttributes()
return Select::make('property_id')
->required()
->key('property_select')
->extraAttributes(function (Get $get) {
// This field is a cascade from company, disable selection if no company yet
return ['class' => $get('company_id') ? '' : 'disabled'];
})
->placeholder('Select Property')
->selectablePlaceholder(false)
->prefixIcon('mdi-home-city')
->label('Property')
->options(fn (Get $get) => $get('company_id') ? \Central::getPropertyOptions($get('company_id')) : [])
->preload()
->searchable()
->native(false)
->loadingMessage('Loading Properties...')
->live();
return Select::make('property_id')
->required()
->key('property_select')
->extraAttributes(function (Get $get) {
// This field is a cascade from company, disable selection if no company yet
return ['class' => $get('company_id') ? '' : 'disabled'];
})
->placeholder('Select Property')
->selectablePlaceholder(false)
->prefixIcon('mdi-home-city')
->label('Property')
->options(fn (Get $get) => $get('company_id') ? \Central::getPropertyOptions($get('company_id')) : [])
->preload()
->searchable()
->native(false)
->loadingMessage('Loading Properties...')
->live();
6 replies
FFilament
Created by adnn on 7/2/2024 in #❓┊help
Split a Resource Form in multiple sub navigations?
No description
6 replies
FFilament
Created by adnn on 7/2/2024 in #❓┊help
Split a Resource Form in multiple sub navigations?
No description
6 replies
FFilament
Created by heat23. on 7/2/2024 in #❓┊help
How do I open a Filament Form in a Modal?
Checkout the modals section for actions https://filamentphp.com/docs/3.x/actions/modals
3 replies
FFilament
Created by Ron on 5/5/2024 in #❓┊help
How to close an ActionGroup dropdown with a custom function after the function completes
@Majid Al Zariey thank you for the quick response and the solution. That code worked perfectly.
5 replies