F
Filament14mo ago
Jacko

Filament Fabricator, return object from select field

Hey, I'm new to Filament/Laravel so sorry for the noob Q - I'm trying to create a CMS type back-end for a website. I have a model called "Machine" and each machine should be capable of having an associated public page. Is there a way in fabricator to return a machine object to the blade file, as opposed to just the ID, when using a select field in the block with all machines listed.
return Block::make('machine')
->schema([
TextInput::make('name'),
Select::make('machine_id')
->label('Machine')
->options(\App\Models\Machine::pluck('name', 'id')->toArray())
]);
return Block::make('machine')
->schema([
TextInput::make('name'),
Select::make('machine_id')
->label('Machine')
->options(\App\Models\Machine::pluck('name', 'id')->toArray())
]);
$machineId works in the block template but I want to have access to the full machine object. Thanks
1 Reply
awcodes
awcodes14mo ago
check the #fabricator channel, and ask in there if you don't see anything.
Want results from more Discord servers?
Add your server