usmcgator
usmcgator
FFilament
Created by usmcgator on 10/11/2023 in #❓┊help
wire:click in navigation in v2?
Is there a way to bind navigation items to a livewire click action? I have SPA navigation working in a custom page but would like to move the nav to the Filament navigation menu. There are actions a user takes that should update a badge for a menu item and I'd like it to update without a page reload. Possible?
3 replies
FFilament
Created by usmcgator on 7/20/2023 in #❓┊help
Suggestions for Wizard navigation
I used some of the Wizard code to create a similar experience in my app. It generally works well, but after seeing it on several aging monitors, it seems as if many people experience the navigation items being cropped by the next nav item, even before they shrink the screen size. This is a navigation with visual cues to indicate when that step in the Wizard has been complete. It shows the svg circle with an checkmark or x inside if complete or not. Any suggestions on having all items shrink as space becomes an issue, and maybe putting the icon below the text at some point? Thanks!
3 replies
FFilament
Created by usmcgator on 7/17/2023 in #❓┊help
display count matching getTableRecordClassesUsing
I have a component displaying a table and it's highlighting certain rows using the getTableRecordClassesUsing() function. The blade file is pretty simple as it just returns the table. However, I'd like to have the count of rows matching the getTableRecordClassesUsing() available in this blade file as I'd like to do some other blade logic based on that value. I tried saving the count in a variable, but it doesn't get updated below the table after the user edits a record making it no longer match the getTableRecordClassesUsing() function. Any help would be greatly appreciated.
<div>
{{ $this->table }}
</div>

Count matching CSS rule: {{ $this->records_match }}
<div>
{{ $this->table }}
</div>

Count matching CSS rule: {{ $this->records_match }}
4 replies
FFilament
Created by usmcgator on 7/9/2023 in #❓┊help
Filter on role
I'd like a table filter for roles but can't figure out how to do it? I can create a filter based on columns in a table, but haven't figured out how to do it with roles. Any input would be greatly appreciated.
2 replies
FFilament
Created by usmcgator on 5/23/2023 in #❓┊help
counts not working on relationship
I'm trying to add a column that shows a count of the related records. This code correctly displays JSON output of the related records, so I know it's getting them correctly, but counts() doesn't work. This gets results from the relationship:
TextColumn::make('goals'),
TextColumn::make('goals'),
This fails with: Call to a member function goals() on null
TextColumn::make('goals_count')->counts("goals"),
TextColumn::make('goals_count')->counts("goals"),
Here are the relationships:
public function mission()
{
return $this->belongsTo(Mission::class, 'mission_id', 'id');
}

public function goals()
{
return $this->mission->goals()->with('mission');
}
public function mission()
{
return $this->belongsTo(Mission::class, 'mission_id', 'id');
}

public function goals()
{
return $this->mission->goals()->with('mission');
}
Where am I going wrong?
8 replies
FFilament
Created by usmcgator on 5/22/2023 in #❓┊help
Custom table action for related resources
I have missions and goals components. In the missions component, I created a "Create Goal" table action which renders a modal to add a goal for that mission. When I click submit, it wants to add the record to the missions table, not the goals table. Here's my action code. How do I get it to save to the goals table, also, how do I pass the mission_id to this action?
protected function getTableActions(): array
{
return [
CreateAction::make('Create Goal')
->form(function (Goal $goal) use ($user) {
$form = Form::make('createGoal', [
'model' => $goal,
]);
$form->schema([
Hidden::make('mission_id')
->default(mission_id value???)
....
protected function getTableActions(): array
{
return [
CreateAction::make('Create Goal')
->form(function (Goal $goal) use ($user) {
$form = Form::make('createGoal', [
'model' => $goal,
]);
$form->schema([
Hidden::make('mission_id')
->default(mission_id value???)
....
4 replies
FFilament
Created by usmcgator on 5/11/2023 in #❓┊help
consume an external API with Filament Tables
I tried a new Laravel install using this package https://filamentphp.com/blog/how-to-consume-an-external-api-with-filament-tables, but it always returns a "could not find driver" error. I'm not sure why it's doing this as the entire purpose of this package is to consume JSON and use it in a Filament table without having to use a database. I tried a clean install using the instructions here https://github.com/leandrocfe/filament-tables-json-data-source, but it always results in the same error. Any ideas? could not find driver CREATE TABLE "publications" ( "id" integer NOT NULL PRIMARY key autoincrement, "title" varchar, "description" varchar, "price" integer, "rating" float, "brand" varchar, "category" varchar, "thumbnail" varchar )
12 replies
FFilament
Created by usmcgator on 5/6/2023 in #❓┊help
Wizard Steps as Table views?
This may be outside the use case of the Wizard, but is there any way to make each step show a table list of records from different tables? The use case is review of imported records, if the list looks correct, they check a box and click Next. It won't progress to the next step unless that box is ticked. The next step is another table list of records from a different table where they do the same. There will be steps where they will have to add/edit records in other tables in addition to the table list steps. Is this possible?
5 replies
FFilament
Created by usmcgator on 4/26/2023 in #❓┊help
Policy for Settings Plugin?
I tried creating a policy for the settings plugin, but it appears to have no effect. All other policies I have work as expected, except this one. This is how I generated the policy:
php artisan make:policy SettingsPolicy --model=Spatie\LaravelSettings\Settings
php artisan make:policy SettingsPolicy --model=Spatie\LaravelSettings\Settings
6 replies
FFilament
Created by usmcgator on 4/24/2023 in #❓┊help
Write to cache after submit
I created a --simple filament resource. How do I write the values from the create/edit form to cache after it gets updated in the database?
16 replies
FFilament
Created by usmcgator on 4/18/2023 in #❓┊help
TableWidget Actions not working as expected
I'm trying to add actions to a WidgetTable, but the actions don't work as expected. When clicking on the Edit link, it appears to call the Save method as I get a notification in the upper right that it was saved. Where am I going wrong?
protected function getTableActions(): array
{
return [
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
];
}
protected function getTableActions(): array
{
return [
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
];
}
19 replies
FFilament
Created by usmcgator on 4/14/2023 in #❓┊help
How to set prependActions on table
Is there a similar method to the ->prependActions() method when creating a table definition in a TableWidget? I'm getting the Table Actions like this:
protected function getTableActions(): array
{
return [
Impersonate::make('impersonate')->icon('heroicon-o-users'),
];
}
protected function getTableActions(): array
{
return [
Impersonate::make('impersonate')->icon('heroicon-o-users'),
];
}
but I don't think there's a getTablePrependActions() method similar to ->prependActions() , so I tried making a public function, but that didn't work.
public function getTablePrependActions(): int | string | array
{
return [
Impersonate::make('impersonate'),
];
}

public function render(): View
{
$this->getTablePrependActions();
return view('filament.widgets.user-widget');
}
public function getTablePrependActions(): int | string | array
{
return [
Impersonate::make('impersonate'),
];
}

public function render(): View
{
$this->getTablePrependActions();
return view('filament.widgets.user-widget');
}
Where am I going wrong here?
28 replies
FFilament
Created by usmcgator on 4/7/2023 in #❓┊help
Wizard with each step from different model?
Most examples I've seen of the Filament wizard are to separate all the fields from a single model into a multi-step process, like adding name, email, password when creating a new user account. It's still all just submitting to the user table. I'd like the wizard to step through adding data to multiple forms, each adding their respective data to a different table. Is this doable?
6 replies
FFilament
Created by usmcgator on 4/6/2023 in #❓┊help
set $columnSpan dynamically?
Is there any way to set $columnSpan based on logic? I'd like a widget to have full span when another widget next to it gets hidden based on logic.
20 replies
FFilament
Created by usmcgator on 4/6/2023 in #❓┊help
Filling a table with data?
Most of my app displays data from tables, and Filament makes them look beautiful with pagination, filters, etc. There is one section where I'm not pulling from an internal table but an external source that returns JSON. To keep things looking consistent, it'd be great if I could populate a Filament table with this JSON and leverage all the goodies that come with tables. Doable?
5 replies