F
Filament5mo ago
ChrisB

Contents of a Select using SQL type query

I'm sorry for the fundamental nature of this query, but I'm still piecing Filament / Laravel together this is another of those scenarios that has me confused. I know there are relationship scenarios on this, but I'd like to understand the wider flexibility for a query like this. Basically, in the code below, how would I extract another value of the form and place it in to that position in the where query. I have worked out if I add "auth()->user()->id" in there, it works fine, however that isn't the value I'm after.
Select::make('userpermission_id')
->options(UserPermissions::where('system_link',# INSERTED HERE NEEDS TO BE THE VALUE OF ANOTHER FIELD OF THE SAME FORM #)->pluck('permission_name', 'id'))
Select::make('userpermission_id')
->options(UserPermissions::where('system_link',# INSERTED HERE NEEDS TO BE THE VALUE OF ANOTHER FIELD OF THE SAME FORM #)->pluck('permission_name', 'id'))
Thanks in advance.
Solution:
Look at Forms\Set and Forms\Get in the documentation
Jump to solution
2 Replies
Solution
Tieme
Tieme5mo ago
Look at Forms\Set and Forms\Get in the documentation
ChrisB
ChrisB5mo ago
Bingo!
->options(function (Forms\Get $get): Collection {
return UserPermissions::where('system_link', $get('system_id'))->pluck('permission_name', 'id');
->options(function (Forms\Get $get): Collection {
return UserPermissions::where('system_link', $get('system_id'))->pluck('permission_name', 'id');
Want results from more Discord servers?
Add your server
More Posts