NikSpyratos
How do form fields with relationships work?
I'm using the spatie roles and permissions on my Filament panel, and would like to write some tests to assert that permissions change appropriately in my
EditRole
form. The result I'm seeing is that in my tests if I populate the permissions
form field with permission IDs, no changes are being saved specifically in the test. So I thought I'd dive in to see how the relation fields work.
I have the following:
But I can't figure out where Filament actually processes this for saving - handleRecordUpdate
and mutateFormDataBeforeSave
don't have any permissions
key, but the permissions update just fine.5 replies
Tests: assertActionDoesNotExist failing for DeleteAction
I have a simple test to check if my
DeleteAction
s are being hidden appropriately for users that don't have the permission.
This works fine in the app, but in my tests the assertions don't seem to behave the same way.
My test is as follows (assuming I have a user with the relevant lack of permissions):
Assuming the ThingPolicy
returns false
for delete/deleteAny (which it does), why does the test always fail? To prove my point, I changed it to assertActionExists
and it passes.
I've tried to dive in to see where DeleteAction
might check the relevant model policy but I can't find it.4 replies
How are input macros registered in V3?
In v2 you would call ::macro on your input in your provider
Filament::serving
call. I'm not sure if I'm missing something, but I don't see any v3 docs on the appropriate method to register these macros in v3. The algolia search for macro
only gives results for across
, and searching DDG/Google with site:filamentphp.com
only returns tips & tricks articles from 2022.4 replies
Set table row limit in tests
Heyo. Not sure if there are questions for this already, couldn't see any but my search terms might not be the same as what exists.
I'm looking to set the table row size limit in my tests, how do I do that? And is it the same for RelationManagers?
I have a relation manager table I'm testing against, but have more than 10 relation records.
4 replies
How to handle macros in resource tests?
I'm writing a test for my resource. In this resource is a TextInput macro defined in AppServiceProvider. When I run my test, I get this error:
The test itself:
I'm assuming this is because the
Livewire
usage is separate from the app instance in the test and thus won't have the macro? Is there away to link this up?1 replies
Vite assets / npm run build - loads new theme once, then only loads vendor theme
Posted this on GH discussions a few days ago, no responses there so I figured I'd try my luck here for some more visibility.
This issue feels super weird and I'm not sure how to investigate it further or if I should file an actual issue report.
I've followed the appearance customisation instructions. On my local it works fine. On my production instance, on a fresh asset build, Filament will correctly use the built asset
filament.css
for the theme once, but subsequent loads just uses the vendor Filament CSS.
Viewing page source shows this link change. I've even added logging in the service provider to log Filament::getThemeLink()
and on each page load (even when it's defaulting to the vendor one in the page source) and it's always the built asset.
I'm using Octane if that matters at all?6 replies