DanielvdSpoel
DanielvdSpoel
FFilament
Created by DanielvdSpoel on 10/5/2024 in #❓┊help
File upload not working with zip files
No description
3 replies
FFilament
Created by DanielvdSpoel on 8/30/2024 in #❓┊help
Typing of getOwnerRecord and Filament::getTenant()
I'm currently using larastan to make sure my code is clean and fully typed, but i find myself to have to do a lot of code comments to make sure the code is properly typed both for my editor and larastan. I'm talking about stuff like this:
->hidden(function (RelationManager $livewire) {
/** @var Product $product */
$product = $livewire->getOwnerRecord();
return $product->packages->count() < 2;
})
->hidden(function (RelationManager $livewire) {
/** @var Product $product */
$product = $livewire->getOwnerRecord();
return $product->packages->count() < 2;
})
and
Actions\CreateAction::make()
->hidden(function () {
/** @var Organization $organization */
$organization = Filament::getTenant();
Actions\CreateAction::make()
->hidden(function () {
/** @var Organization $organization */
$organization = Filament::getTenant();
is there any way to improve this, and be able to directly used Filament::getTenant and have it typed?
3 replies
FFilament
Created by DanielvdSpoel on 8/1/2024 in #❓┊help
Manually getting media
The upload and table column work great, but now I want to grab the thumbnail to use in a controller, but I have no way of knowing what is the thumbnail. Since there can be multiple media files connected to an model. How do I do this?
2 replies
FFilament
Created by DanielvdSpoel on 6/16/2024 in #❓┊help
Actions
What would be the best way to define a function that can be used as a bulk action, table action and page action? Do i need 3 seperate action classes?
3 replies
FFilament
Created by DanielvdSpoel on 6/8/2024 in #❓┊help
Eager loading relationships in table
I currently have this piece of code:
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('last_name')
->label(__('labels.name'))
->getStateUsing(fn(Volunteer $record) => $record->person->fullName())
->sortable()
->searchable(['person.first_name', 'person.middle_name', 'person.last_name']),
Tables\Columns\TextColumn::make('person.email')
->label(__('labels.email'))
->sortable()
->searchable(),
Tables\Columns\TextColumn::make('function')
->label(__('labels.function'))
->sortable()
->searchable(),
])
->modifyQueryUsing(fn(Builder $query) => $query->with('person'))
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('last_name')
->label(__('labels.name'))
->getStateUsing(fn(Volunteer $record) => $record->person->fullName())
->sortable()
->searchable(['person.first_name', 'person.middle_name', 'person.last_name']),
Tables\Columns\TextColumn::make('person.email')
->label(__('labels.email'))
->sortable()
->searchable(),
Tables\Columns\TextColumn::make('function')
->label(__('labels.function'))
->sortable()
->searchable(),
])
->modifyQueryUsing(fn(Builder $query) => $query->with('person'))
When trying to search i get the error "SQLSTATE[42P01]: Undefined table: 7 ERROR: missing FROM-clause entry for table "person" LINE 1: ...nt(*) as aggregate from "volunteers" where (lower(person.fir... ^" Does anyone have an insight in how i might fix this? I thought the $query->with() would already solve it but unfortuantly it doesn't
14 replies
FFilament
Created by DanielvdSpoel on 5/19/2024 in #❓┊help
Define tenant in PestPHP test
I'm writing a test to check if it can render my list page, i'm using this code:
it('can render the index page', function () {
livewire(ListAccounts::class, [
'tenant' => $this->household,
])
->assertSuccessful();
})->group('index', 'page', 'resource');
it('can render the index page', function () {
livewire(ListAccounts::class, [
'tenant' => $this->household,
])
->assertSuccessful();
})->group('index', 'page', 'resource');
But i'm getting this error:
Illuminate\Routing\Exceptions\UrlGenerationException: Missing required parameter for [Route: filament.household.resources.accounts.index] [URI: {tenant}/accounts] [Missing parameter: tenant].
Illuminate\Routing\Exceptions\UrlGenerationException: Missing required parameter for [Route: filament.household.resources.accounts.index] [URI: {tenant}/accounts] [Missing parameter: tenant].
does anyone know the right way of providing the tenant?
4 replies
FFilament
Created by DanielvdSpoel on 5/18/2024 in #❓┊help
Filament::getTenant() has no such method
The getTenant method returns a generic type object which ofcourse doesn't have the same methods as my tenant model, is there any way to tell my IDE/PHPStan that those methods do exists? Example:
$rule->where('household_id', Filament::getTenant()?->id);
$rule->where('household_id', Filament::getTenant()?->id);
Error that i get: 51 Access to an undefined property Illuminate\Database\Eloquent\Model::$id.
5 replies
FFilament
Created by DanielvdSpoel on 1/12/2024 in #❓┊help
Multi select relationship complaining about json?
I have this component:
Select::make('related_products')
->label('Related Products')
->relationship('products', 'name')
->preload()
->multiple()
->searchable(),
Select::make('related_products')
->label('Related Products')
->relationship('products', 'name')
->preload()
->multiple()
->searchable(),
But i get this error: https://flareapp.io/share/x5MZXKem name is not json, so i have no clue what's going wrong
3 replies
FFilament
Created by DanielvdSpoel on 1/5/2024 in #❓┊help
500 error on production
I get the following error after a V2 -> V3 upgrade on production, local is fine:
Unable to locate a class or view for component [filament-support::loading-indicator]. (View: /home/kwekerijvh/kwekerijvh.nl/vendor/filament/support/resources/views/components/button.blade.php) (View: /home/kwekerijvh/kwekerijvh.nl/vendor/filament/support/resources/views/components/button.blade.php) (View: /home/kwekerijvh/kwekerijvh.nl/vendor/filament/support/resources/views/components/button.blade.php) (View: /home/kwekerijvh/kwekerijvh.nl/vendor/filament/support/resources/views/components/button.blade.php) (View: /home/kwekerijvh/kwekerijvh.nl/vendor/filament/support/resources/views/components/button.blade.php) (View: /home/kwekerijvh/kwekerijvh.nl/vendor/filament/support/resources/views/components/button.blade.php)
Unable to locate a class or view for component [filament-support::loading-indicator]. (View: /home/kwekerijvh/kwekerijvh.nl/vendor/filament/support/resources/views/components/button.blade.php) (View: /home/kwekerijvh/kwekerijvh.nl/vendor/filament/support/resources/views/components/button.blade.php) (View: /home/kwekerijvh/kwekerijvh.nl/vendor/filament/support/resources/views/components/button.blade.php) (View: /home/kwekerijvh/kwekerijvh.nl/vendor/filament/support/resources/views/components/button.blade.php) (View: /home/kwekerijvh/kwekerijvh.nl/vendor/filament/support/resources/views/components/button.blade.php) (View: /home/kwekerijvh/kwekerijvh.nl/vendor/filament/support/resources/views/components/button.blade.php)
already tried php artisan optimize:clear
5 replies
FFilament
Created by DanielvdSpoel on 11/13/2023 in #❓┊help
Select required validations fails while it's set?
I have a wizard component, where the second step is dynamic based on a select from the first step, Code that returns the fields:
public static function getSettings(): array
{
return [
Select::make('settings.datasets')
->label(__('labels.datasets'))
->options(Dataset::pluck('name', 'id'))
->required()
->searchable(),
Select::make('settings.interaction_list')
->label(__('labels.interaction_list'))
->options(InteractionList::pluck('name', 'id'))
->helperText(__('filament.resources.tasks.interaction_list_helper'))
->searchable(),
TextInput::make('settings.similarity')
->label(__('labels.similarity_threshold'))
->suffix('%')
->numeric()
->step(1)
->minValue(0)
->maxValue(100)
->required()
->default(75),
TextInput::make('settings.min_cluster_size')
->label(__('labels.min_cluster_size'))
->suffix(__('labels.items'))
->numeric()
->step(1)
->required()
->minValue(1)
->default(2),
TextInput::make('settings.cluster_report_name') //todo make unique
->label(__('labels.cluster_report_name'))
->required()
->default('Cluster Report'),

];
}
public static function getSettings(): array
{
return [
Select::make('settings.datasets')
->label(__('labels.datasets'))
->options(Dataset::pluck('name', 'id'))
->required()
->searchable(),
Select::make('settings.interaction_list')
->label(__('labels.interaction_list'))
->options(InteractionList::pluck('name', 'id'))
->helperText(__('filament.resources.tasks.interaction_list_helper'))
->searchable(),
TextInput::make('settings.similarity')
->label(__('labels.similarity_threshold'))
->suffix('%')
->numeric()
->step(1)
->minValue(0)
->maxValue(100)
->required()
->default(75),
TextInput::make('settings.min_cluster_size')
->label(__('labels.min_cluster_size'))
->suffix(__('labels.items'))
->numeric()
->step(1)
->required()
->minValue(1)
->default(2),
TextInput::make('settings.cluster_report_name') //todo make unique
->label(__('labels.cluster_report_name'))
->required()
->default('Cluster Report'),

];
}
18 replies
FFilament
Created by DanielvdSpoel on 11/6/2023 in #❓┊help
Relation column search
I have the following column:
Tables\Columns\TextColumn::make('person.full_name')
->searchable(['person.first_name', 'person.last_name'])
->label(__('labels.name'))
->sortable(),
Tables\Columns\TextColumn::make('person.full_name')
->searchable(['person.first_name', 'person.last_name'])
->label(__('labels.name'))
->sortable(),
I know this is propably a bit of a stretch, but i would like this to work, instead i'm getting this error: https://flareapp.io/share/dPbWEeX7
4 replies
FFilament
Created by DanielvdSpoel on 11/6/2023 in #❓┊help
Filament ignoring foreign key constraints
Pretty simple, i have a foreign key constraint on a table, but filament is able to delete records i'm not allowed to delete in the database? Is there some sort of option I need to enable?
15 replies
FFilament
Created by DanielvdSpoel on 10/18/2023 in #❓┊help
Checklist not sorted correctly
I have this code:
CheckboxList::make('days')
->label('Standaard beschikbaarheid')
->relationship('days', 'name', function (Builder $query) {
return $query->orderBy('day_of_week');
})
->getOptionLabelFromRecordUsing(fn (Model $record) => __('days.' . $record->name))
CheckboxList::make('days')
->label('Standaard beschikbaarheid')
->relationship('days', 'name', function (Builder $query) {
return $query->orderBy('day_of_week');
})
->getOptionLabelFromRecordUsing(fn (Model $record) => __('days.' . $record->name))
but it's not being sorted, does anyone know why?
10 replies
FFilament
Created by DanielvdSpoel on 10/17/2023 in #❓┊help
Filament testing breaks down as soon as i use a policy
So let's say i have a simple test:
it('can delete', function () {
$dataset = Dataset::factory()->create();

livewire(DatasetResource\Pages\EditDataset::class, [
'record' => $dataset->getRouteKey(),
])
->callAction(DeleteAction::class);

$this->assertModelMissing($dataset);
});
it('can delete', function () {
$dataset = Dataset::factory()->create();

livewire(DatasetResource\Pages\EditDataset::class, [
'record' => $dataset->getRouteKey(),
])
->callAction(DeleteAction::class);

$this->assertModelMissing($dataset);
});
THis works fine if there is no dataset policy, as soon as there is one i get this error: FAILED Tests\Feature\DatasetTest > it can delete Error
Call to a member function getAction() on null at vendor/filament/actions/src/Testing/TestsActions.php:141 137▕ / @var array<string> $name */ 138▕ / @phpstan-ignore-next-line */ 139▕ $name = $this->parseNestedActionName($name); 140▕ ➜ 141▕ $action = $this->instance()->getAction($name); 142▕ 143▕ $livewireClass = $this->instance()::class; 144▕ $prettyName = implode(' > ', $name); 145▕ +9 vendor frames 10 tests/Feature/DatasetTest.php:84 The policy returns true for all functions.. does anybody have a clue what's going on?
19 replies
FFilament
Created by DanielvdSpoel on 10/3/2023 in #❓┊help
CSS issue?
This is a pretty fresh project, but i have some weird css issue. I didn't publish any views and i did build my theme: https://gyazo.com/bcf5a7dbf4291588c06700fbed08599b
4 replies
FFilament
Created by DanielvdSpoel on 9/23/2023 in #❓┊help
Simple resource "new tenancy user" tries to create record upon opening model
See description, i have a plain simple resource but as soon as i click on the "new model" button it gives an error becouse it tries to insert a record into the database without any data. How can i fix this?
2 replies
FFilament
Created by DanielvdSpoel on 9/23/2023 in #❓┊help
Postgres support filament demo
Hello! I'm using the filament demo application to develop plugins, but since changing to postgres it no longer works. Postgres doesn't support virtual columns (it seems?) And it gives an error on the addresses migrations. Was anyone able to fix this?
4 replies
FFilament
Created by DanielvdSpoel on 9/17/2023 in #❓┊help
2 themes for 2 panels
I have two panels and i need a theme for both of them, apperently i can't use the same. But vite also doesn't seem to be able to build two themes? How do I do this?
4 replies
FFilament
Created by DanielvdSpoel on 9/3/2023 in #❓┊help
Disable creation of new tenants
Is it possible to disable the creation of new tenants in some way? I want to limit the amount of tenants a user can make
6 replies
FFilament
Created by DanielvdSpoel on 9/2/2023 in #❓┊help
Tenant panel gives 404
I have a tenancy panel, when i log in and create a tenant i get redirected and get a 404 page. Does anyone know what's going on?
6 replies