javalava6985
Table results missing
I have a filament table that is sorted using a tab:
public function getTabs(): array {
return [
'future' => Tab::make('Planning')
->badge(Project::query()->where('deleted_at', null)->where('date', '>=', today())->count())
->modifyQueryUsing(function ($query){
return $query->where('deleted_at', null)->where('date', '>=', today());
}),
'all' => Tab::make('Alles')
->badge(Project::query()->where('deleted_at', null)->count())
->modifyQueryUsing(function ($query){
return $query->where('deleted_at', null);
}),
'past' => Tab::make('Historie')
->badge(Project::query()->where('deleted_at', null)->where('date', '<', today())->count())
->modifyQueryUsing(function ($query){
return $query->where('deleted_at', null)->where('date', '<', today());
}),
'canceled' => Tab::make('Geannuleerd')->modifyQueryUsing(function ($query){
return $query->whereNot('deleted_at', null);
}),
];
}
Sometimes results show up on the 'all' tab that do not show up on the 'future' tab. When it happens it's always the first result of the second page of pagination. For example: result 25 is showing, result 26 should be the first result on the next page but it's showing result 27. I can search for result 26 and it will show up. This happens on all pagination sorts except for when i show all results. When i show all results, it shows up. Both for the 'all" tab and showing all results on pagination.
Using:
Filament 3.2.132
Laravel 11.34.2
Livewire 3.5.12
PHP 8.3.13
Edit:
The results also do not show up in the HTML. So i'm guessing it's not a css issue or similar.1 replies
Use ID on newly created Model from ->createOptionAction
For the life of me i can't seem to figure this out.
I have a select form that uses ->createOptionForm so that i can create a new one (company in this case) as well. I want to perform some actions on it after creating like i can do with the afterCreate() method on my create page.
So far i have:
No matter what i try my Model in the ->after() method is always null ($action->after(function ($data, Model $record) {).
13 replies
Custom filter count is zero
I have made a custom DateFilter:
It extends the SelectFilter:
In the setUp method i have used $this->indiscateUsing(). This displays the indicators but it does not update the filter count. I can see in the docs that i need to use the ->indicateUsing for the count to update but how do i make it work with a custom filter?
2 replies
Testting anonymous actions
I have an infolist (ViewProject.php) for my ProjectResource. This just displays a number of sections and groups. Of of those sections contains a number of anonymous actions, like:
The action itself works just fine, i just have no idea how to reach this action in a (pest) test. Can someone point me in the right direction or tell me how i can refactor if i need to rewrite my actions.
3 replies
Costumize AttachAction
I have a relation manager in a Laravel Filament V3 app. It manages the relation between my Project model and my Attendee model. They are connected through a pivot table and a BelongsToMany relationship.
When i add the AttachAction in the header i want to be able to search my projects by name but the name is not on the Project model itself. The name is set on a Course model which is connected trough a HasMany / BelongsTo relationship.
I've tried to do this. The TextColumn gives the title of the course but the AttachAction does not work: Unknown column 'course.title' in 'where clause'
2 replies
Advice on user roles
I'm looking for a bit of advice on how to construct my app. I'm starting a new project with laravel filament v3. I have a couple of different user roles but the main are 3 different roles. We have 2 different companies that are seperated from one another but operate in a similar fashion. I have an admin role that should see all the clients, meetings etc. for bith companies. the other 2 roles are from the 2 different companies and they should only be able to see the clients, meetings etc. for their own compay. How would you construct this app?
- Option 1: 1 admin panel with multiple user roles;
- Option 2: A different panel for each role
- Option 3: Implement the multi-tenancy options from filament v3.
1 replies
Set the state of ->afterStateUpdated inside a test
My page shows some text after the user selects a certain entry form a Select::make(). I use the ->afterStateUpdated method to change the text if a certain condition is met. Does anyone know how i can implement this inside a (Pest) test?
The following doesn't work:
$livewire = livewire(CreateReport::class)
->set('client_id', $newReport->client->getKey())
->call('afterStateUpdated', 'client_id'); // Call the afterStateUpdated method if needed
I'm in V3.
1 replies
Testing with Pest keeps giving a 403 response
I'm trying to test my filament (V3) app with pest. I've added the actingAs rule in the setup for TestCase.php as per the documentation. However, when i try to test my ClientResource with the code:
it('can render page', function () {
$this->get(ClientResource::getUrl('index'))->assertSuccessful();
});
I keep getting a 403 on running the test. Any idea what i'm doing wrong?
1 replies