Veur
Veur
FFilament
Created by Veur on 6/5/2024 in #❓┊help
Testing Repeater component
I'm trying to test a Repeater component: https://filamentphp.com/docs/3.x/forms/fields/repeater#testing-repeaters It says I should add $undoRepeaterFake = Repeater::fake(); at the beginning of the test. But the fake() method doens't exist on the Repeater component class: Method Filament\Forms\Components\Repeater::fake does not exist. Any idea what I'm missing?
4 replies
FFilament
Created by Veur on 4/8/2024 in #❓┊help
Update Select options after event
I have a Select field with options from a database. Now I want to update the list of options after a Livewire event was dispatched. Is this possible?
24 replies
FFilament
Created by Veur on 2/7/2024 in #❓┊help
Test an Action with `requiresConfirmation()`
I have an Action which implements ->requiresConfirmation() How can I write a test that checks if the action works after the "Confirm" button inside the confirmation modal is clicked?
5 replies
FFilament
Created by Veur on 1/24/2024 in #❓┊help
Get the records of a Table (with filters applied)
Using the InteractsWithPageTable trait I am able to retrieve any table query and get the list of records. But it does not have the filters & sorting applied. Anybody knows how to get the query including the filters (which are persisted in the session)?
use InteractsWithPageTable;

public function mount()
{
dd($this->getPageTableQuery()->get());
}

protected function getTablePage(): string
{
return UsersTable::class;
}
use InteractsWithPageTable;

public function mount()
{
dd($this->getPageTableQuery()->get());
}

protected function getTablePage(): string
{
return UsersTable::class;
}
This dumps a list of all records of the table, instead of only the records that are visible in the table with the applied filters.
2 replies
FFilament
Created by Veur on 1/10/2024 in #❓┊help
CreateOptionForm is not showing
I have a working form that contains a select field to set a user's city_id. I'm trying to add a createOptionForm, but the modal won't show up (but there is network activity, see video). I'm on the latest Filament version, and the form is loaded in a custom Livewire component (outside a Panel). This is the code of the form:
protected function form(Form $form): Form
{
return $form
->schema([
Select::make('city_id')
->label('Select city')
->relationship('city', 'name')
->preload()
->required()
->createOptionForm([
TextInput::make('name')
->label('City')
->required(),
]),
])
->model($this->user);
}
protected function form(Form $form): Form
{
return $form
->schema([
Select::make('city_id')
->label('Select city')
->relationship('city', 'name')
->preload()
->required()
->createOptionForm([
TextInput::make('name')
->label('City')
->required(),
]),
])
->model($this->user);
}
And the relationship in the User model:
public function city()
{
return $this->belongsTo(City::class);
}
public function city()
{
return $this->belongsTo(City::class);
}
BTW: the form is loaded in a https://wire-elements.dev/pro SlideOver from @Philo
5 replies
FFilament
Created by Veur on 1/5/2024 in #❓┊help
TextColumn with subquery value
I have a Filament Table (outside a panel) listing records from a relationship. In the select statement of the query I added a subquery, which counts a certain number of records. But the value from the subquery isn't displayed in the table. While I see the attribute has a value when I dd() the query. Any ideas? Below is the $table code:
public function table(Table $table): Table
{
return $table
->relationship(fn (): HasMany => $this->user->clients()
->addSelect([
'vacancies_count' => Vacancy::query()
->selectRaw('COUNT(*)')
->whereColumn('client_id', 'teams.id')
->active()
])
)
->inverseRelationship('user')
->columns([
TextColumn::make('vacancies_count')
->sortable(),
]);
}
public function table(Table $table): Table
{
return $table
->relationship(fn (): HasMany => $this->user->clients()
->addSelect([
'vacancies_count' => Vacancy::query()
->selectRaw('COUNT(*)')
->whereColumn('client_id', 'teams.id')
->active()
])
)
->inverseRelationship('user')
->columns([
TextColumn::make('vacancies_count')
->sortable(),
]);
}
1 replies
FFilament
Created by Veur on 12/12/2023 in #❓┊help
Custom theme: Unable to locate file in Vite manifest
I created a custom theme according to: https://filamentphp.com/docs/3.x/panels/themes#creating-a-custom-theme Then I registered it in the Panel provider: ->viteTheme('resources/css/filament/client/theme.css') This is my vite.config.js:
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';

export default defineConfig({
plugins: [
laravel({
input: [
'resources/css/app.css',
'resources/css/client.css',
'resources/js/app.js',
],
refresh: true,
}),
],
input: [
'resources/css/filament/client/theme.css',
],
});
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';

export default defineConfig({
plugins: [
laravel({
input: [
'resources/css/app.css',
'resources/css/client.css',
'resources/js/app.js',
],
refresh: true,
}),
],
input: [
'resources/css/filament/client/theme.css',
],
});
And I ran npm run build But in production it still gives this error (locally it works fine): Unable to locate file in Vite manifest: resources/css/filament/client/theme.css
11 replies
FFilament
Created by Veur on 12/11/2023 in #❓┊help
Add an Action to a Form label or hint
Is there a way to add an Action to the field label of a Filament Form? Kind of like this (see video). Or add an Action to a field's hint()?
14 replies
FFilament
Created by Veur on 12/4/2023 in #❓┊help
Move Table filter indicators to header toolbar
No description
6 replies
FFilament
Created by Veur on 11/22/2023 in #❓┊help
CreateOptionForm is not showing
I have a working form that contains a select field to set a user's city_id. I'm trying to add a createOptionForm, but the modal won't show up (but there is network activity, see video). This is the code of the form:
protected function form(Form $form): Form
{
return $form
->schema([
Select::make('city_id')
->label('Select city')
->relationship('city', 'name')
->preload()
->required()
->createOptionForm([
TextInput::make('name')
->label('City')
->required(),
]),
])
->model($this->user);
}
protected function form(Form $form): Form
{
return $form
->schema([
Select::make('city_id')
->label('Select city')
->relationship('city', 'name')
->preload()
->required()
->createOptionForm([
TextInput::make('name')
->label('City')
->required(),
]),
])
->model($this->user);
}
And the relationship in the User model:
public function city()
{
return $this->belongsTo(City::class)
->withDefault([
'name' => 'Unknown',
]);
}
public function city()
{
return $this->belongsTo(City::class)
->withDefault([
'name' => 'Unknown',
]);
}
7 replies
FFilament
Created by Veur on 11/11/2023 in #❓┊help
Show Filament Table/Form inside an Infolist tab?
Hi, is there a way to load a Filament Table or Form inside an Infolist tab? I saw the option to create a Custom Entry class: https://filamentphp.com/docs/3.x/infolists/entries/custom#custom-classes But these classes extend the Filament\Infolists\Components\Entry class, which is not a Livewire class. Can somebody point me in the right direction (or tell me it's not possible 😆 )?
4 replies
FFilament
Created by Veur on 11/8/2023 in #❓┊help
Show different widgets in 1 row
No description
7 replies
FFilament
Created by Veur on 11/1/2023 in #❓┊help
Upgrading from v2 to v3: dependencies issue
I am trying to upgrade to v3 from an existing v2 project, and I'm following the https://filamentphp.com/docs/3.x/panels/upgrade-guide I followed all instructions, but when I run composer update I get this list of errors (see attachment). I did not install Livewire v3 yet, as recommended in the Filament upgrade guide ("Please upgrade Filament before upgrading to Livewire v3"). Am I missing something?
4 replies
FFilament
Created by Veur on 10/6/2023 in #❓┊help
Access 1 Filament panel via multiple domains
I want to host a Filament panel on multiple domains. My panel config looks like this:
public function panel(Panel $panel): Panel
{
return $panel
->id('client')
->domains([config('app.domain1'), config('app.domain2')])
public function panel(Panel $panel): Panel
{
return $panel
->id('client')
->domains([config('app.domain1'), config('app.domain2')])
The login screen loads fine on both domains. But when I try to login from domain1, I'm redirect to the login screen of domain2. Logging in from domain2 works fine. Is it possible to get it to work on both domains?
6 replies
FFilament
Created by Veur on 10/5/2023 in #❓┊help
Custumize panel per tenant with spatie/laravel-multitenancy
Hi, is there a way to configure a panel based on the current tenant (which is loaded by the current domain name)? I am using ‘spatie/laravel-multitenancy’ and I tried to access app(‘currentTenant’) in my panel’s service provider, but the currentTenant is not yet bound to the container by then.
5 replies
FFilament
Created by Veur on 9/20/2023 in #❓┊help
How to create a sub-resource
Hi, I'm trying to create a sub-resource for one of my resources. The parent resource is WebsiteResource and the sub-resource is PageResource. The WebsiteResource is accessible from /websites. I want the sub-resource to be accessible through /websites/1/pages (for the list of pages) and /websites/1/pages/1 (for the view of Page:1). I tried to accomplish this with the code below in the sub-resource, but it's giving me a Illuminate\Routing\Exceptions\UrlGenerationException (missing parameter):
public static function getPages(): array
{
return [
'index' => Pages\ListPages::route('/{website}'),
'view' => Pages\ViewPage::route('/{website}/{record}'),
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListPages::route('/{website}'),
'view' => Pages\ViewPage::route('/{website}/{record}'),
];
}
2 replies
FFilament
Created by Veur on 3/30/2023 in #❓┊help
Reordering records with order record in a pivot table
I have a texts and categories table. The Text model has a belongsToMany relationship with the Category model. The pivot table category_text has a sort column. Is there a way to reorder the table and store the order in the pivot table? At the moment I get this error:
Call to a member function update() on null
vendor/filament/tables/src/Concerns/CanReorderRecords.php: 35
Call to a member function update() on null
vendor/filament/tables/src/Concerns/CanReorderRecords.php: 35
2 replies
FFilament
Created by Veur on 3/15/2023 in #❓┊help
Disable records per page select
Is there a way (without css) to disable the records per page dropdown for a specific table?
3 replies
FFilament
Created by Veur on 3/14/2023 in #❓┊help
ActionGroup with a label
5 replies
FFilament
Created by Veur on 3/8/2023 in #❓┊help
Determine Toggle label by state
Is there a way to change the label of a \Filament\Forms\Components\Toggle based on its value? This is what I tried, but it doesn't work: Toggle::make('active') ->label(fn ($record) => $record->active ? 'Active' : 'Inactive')
18 replies