JamesTechDude
Explore posts from serversTLCTuto's Laravel Corner
•Created by JamesTechDude on 8/20/2023 in #💡filament
Making tabs for edit page
There used to be a package for version 2:
https://github.com/aymanalhattami/filament-page-with-sidebar
Unfortunately doesn't support V3 yet (there's a push for it, but in testing, it doesn't work). I see issues reported for that, but for now, is there a Filament way to do some kinda tabs like that plugin does?
On the
edit
page, there will be the edit form
and the relationship manager table
under that
I want to move them into tabs, where you select a tab to view those
My example:
Litters
(resource) has Puppies
(relationship manager)
I would like tabs where you can edit the litter, or just view the puppies - within the same LittersResource
, so you don't scroll down to see Puppies
, you just select the tab...
Maybe this isn't possible... let me know 🙂10 replies
TLCTuto's Laravel Corner
•Created by JamesTechDude on 8/16/2023 in #💡filament
How to set company_id in role_user table
I'm able to assign roles and everything works great, but the currently logged in
company_id
(multi-tenancy) doesn't get saved to the pivot table (remains null)
Is there a way to set the pivot table with the currently logged in company_id
when assigning roles to a user?
I'm using a UserResource
to do this, and I just add the roles selector component using:
Forms\Components\Select::make('roles')
->label(__('Role(s) (Must select at least 1)'))
->required()
->relationship(
name: 'roles',
titleAttribute: 'name',
modifyQueryUsing: fn (Builder $query) => $query->whereNotIn('perm_name', array('admin', 'super-admin')),
)
->native(false)
->multiple()
->searchable()
->preload(),
The company itself will be assigning the roles (not a site admin)16 replies
TLCTuto's Laravel Corner
•Created by JamesTechDude on 8/16/2023 in #💡filament
Hide column in table conditionally
11 replies
TLCTuto's Laravel Corner
•Created by JamesTechDude on 8/15/2023 in #💡filament
Pivot table issue
When creating a new Company Litter, I have a pivot table called
company_litter
that gets filled automatically by Filament
But for some reason it's still requiring a company_id
field in the litters
table
Filament fills in the company_id
in the litters
table, as well as the company_litter
table
Do you know why this might be happening?
I want to remove company_id
from litters
table3 replies
TLCTuto's Laravel Corner
•Created by JamesTechDude on 8/15/2023 in #💡filament
How to customize Table/List view
I'm trying to get rid of the table completely inside of the resource, and replace the results with cards
Is this possible?
5 replies
TLCTuto's Laravel Corner
•Created by JamesTechDude on 8/15/2023 in #💡filament
How to check user roles in canAccessPanel()
Hello, I can't seem to find the code to use to check if a role is assigned to a user from database into canAccessPanel()
I need to check:
role_user pivot table
Admin has role_id 1, user_id 1
Company user has role_id 2, user_id 2
(for this example, but many users will have role_id 2)
I have a different panel for each... AdminPanelProvider for Admin Role, CompanyPanelProvider for Company Role
I tried checking documentation and online and can't figure this out 😦
Thank you in advanced!
55 replies