MAF
MAF
FFilament
Created by MAF on 8/26/2024 in #❓┊help
I want to generate dynamic ExportColumn!
Is there anyway to access $record inside getColumns(), in my case, I want to generate dynamic ExportColumn! i.e., if I have a JSON field, I want to break it down to multiple columns while exporting.
2 replies
FFilament
Created by MAF on 5/22/2024 in #❓┊help
Calling $wire.$id inside custom form element returns the whole form ID and not only the element.
I am trying to use $wire.$call('myFunction') from inside a custom form component, but I get Unable to call component method. Public method [myFunction] not found on component However, it exists in the custom form component. But for some reason $this.$wire calls the parent form object.
5 replies
FFilament
Created by MAF on 5/15/2024 in #❓┊help
I have to submit the form twice to update the table in a custom page with a table and a from
So, I'm building a very complicated wizard that I need to use Filament Forms and Table separately in. To start with, I want the user to write in a text field in a form, submit, then the table shows the results. I did something similar to this, but for some reason, I have to submit the form twice for the table to update.
4 replies
FFilament
Created by MAF on 12/29/2023 in #❓┊help
Is there a way to use Heroicons inside HtmlString?
I want to use some Heroicons inside HtmlString.
2 replies
FFilament
Created by MAF on 10/24/2023 in #❓┊help
How can I work around this `column reference "id" is ambiguous`?
// GradeResource.php

public static function getEloquentQuery(): Builder
{
$query = parent::getEloquentQuery()
->join('schools', 'grades.school_id', '=', 'schools.id')
->select('grades.*', 'schools.name as school_name');
->where('schools.created_by', auth()->id());
}
// GradeResource.php

public static function getEloquentQuery(): Builder
{
$query = parent::getEloquentQuery()
->join('schools', 'grades.school_id', '=', 'schools.id')
->select('grades.*', 'schools.name as school_name');
->where('schools.created_by', auth()->id());
}
5 replies
FFilament
Created by MAF on 9/26/2023 in #❓┊help
Need help with pull request #8553
I had an issue, and proposed this fix, but the maintainers rejected the first proposal, and probably they are busy checking the 2nd proposal. So, can anyone help to direct me to the way that will make the maintainers accept this fix? https://github.com/filamentphp/filament/pull/8553
1 replies
FFilament
Created by MAF on 9/17/2023 in #❓┊help
Visible and Hidden are not working on NavigationItem in NavigationBuilder array
For some reason, neither hidden() nor visible() is working!
public function panel(Panel $panel): Panel
{
return $panel
->navigation(function (NavigationBuilder $builder): NavigationBuilder {
return $builder->items([
NavigationItem::make('Menu Item')
->icon('heroicon-o-arrow-path')
->url(fn (): string => route('filament.admin.resources.products.being-processed'))
->isActiveWhen(fn (): bool => request()->routeIs('filament.admin.resources.products.being-processed'))
->visible(false)
->hidden(true)
]);
});
}
public function panel(Panel $panel): Panel
{
return $panel
->navigation(function (NavigationBuilder $builder): NavigationBuilder {
return $builder->items([
NavigationItem::make('Menu Item')
->icon('heroicon-o-arrow-path')
->url(fn (): string => route('filament.admin.resources.products.being-processed'))
->isActiveWhen(fn (): bool => request()->routeIs('filament.admin.resources.products.being-processed'))
->visible(false)
->hidden(true)
]);
});
}
3 replies
FFilament
Created by MAF on 9/7/2023 in #❓┊help
function lower(bigint) does not exist on Table search on ID field
I have ID column as searchable, but it raises the following error: SQLSTATE[42883]: Undefined function: 7 ERROR: function lower(bigint) does not exist LINE 1
select count(*) as aggregate from "products" where (lower(id)::text like %iphone% or lower(name)::text like %iphone%)
select count(*) as aggregate from "products" where (lower(id)::text like %iphone% or lower(name)::text like %iphone%)
According to the source code, isSearchForcedCaseInsensitive() returns true because the DB engine is PostgreSQL https://github.com/filamentphp/filament/blob/612045cd618829749391cf90a93c29e830a10ee4/packages/tables/src/Columns/Concerns/InteractsWithTableQuery.php#L102)
7 replies
FFilament
Created by MAF on 9/2/2023 in #❓┊help
How to pass current record data to `::steps()` in an `emptyStateActions()` in a `RelationManager`
So, I have a Category model that hasMany products. The Product creation is a wizard with multiple steps(). In Product's table emptyStateActions(), I use Tables\Actions\CreateAction::make()->steps(). But I want to have some data pre-filled from the Category in case this CreateAction was initiated from Category edit view.
4 replies
FFilament
Created by MAF on 9/1/2023 in #❓┊help
How can I pass $state to a static function for a reusable Column/Input?
I have 6 columns for different states. But all of them follow the same convention. So, I would rather not keep repeating the code. I created the following static method.
public static function stateColumn($state): TextColumn
{
return TextColumn::make($state)
->formatStateUsing(fn ($state) => ucfirst($state))
->color([
'danger' => 'failed',
'warning' => 'processing',
'success' => fn ($state) => in_array($state, ['ready'])
]);
}
public static function stateColumn($state): TextColumn
{
return TextColumn::make($state)
->formatStateUsing(fn ($state) => ucfirst($state))
->color([
'danger' => 'failed',
'warning' => 'processing',
'success' => fn ($state) => in_array($state, ['ready'])
]);
}
Now, I want to call this static function within columns array. One thing I found, is a recent video posted on #💫┊announcements about enums. But this will be a lot of code, too. I prefer a single function.
7 replies