Woojava
Confirming you cannot add a new model during an attach?
You have been incredibly helpful! Thanks!
I got this to work:
---
->headerActions([
Tables\Actions\AttachAction::make()
->label('Attach Skill')
->preloadRecordSelect()
->recordSelectSearchColumns(['name'])
->recordSelect(function (Forms\Components\Select $select) {
return $select
->placeholder('Select a skill to attach')
->searchable()
->createOptionForm([
TextInput::make('name')
->unique()
->label('Skill & Talent Name')
->required(),
])
->createOptionUsing(function ($data) {
$skill = Skill::create([
'name' => $data['name'],
]);
return $skill->id;
})
->required();
}),
])
34 replies
Confirming you cannot add a new model during an attach?
Now, the refactor is, can this be combined into a single modal? So, right now, I have two actions: Attach and Create. I'd love to have one action that can Attach or Create a new Skill and attach? If so, is there a code snippet that displays this. If not, that's fine. Just wondering. If you have a recommended set of FilamentPHP video tutorials (I'm a visual learner) I would appreciate it. I'm already subscribed to FilamentDaily and I've watched all of the Filament v3 tutorials on YouTube, but no one is covering these items in detail. Either way, thanks for the active engagement tonight, you have helped me a ton. I am grateful.
34 replies
Confirming you cannot add a new model during an attach?
Yes, I think so. Being to Filament, I want to make sure I'm understanding the terms. On the ProfileResource, there is a SkillRelationManger, when you load it, it display the pivot table values of skills already attached, if any, then there's an Attach button, that opens a model with a search drop-down that I can preloading the values. You can only select a single skill at a time. I can attach a video, if that's helpful.
34 replies
Confirming you cannot add a new model during an attach?
Thanks for replying. I'm just trying to process your response. Being fairly new, I'm familiar with the linked to documentation if there is a select that is populated from a relationship. However, without a relationship populating the select, it's unclear to me how to add this createOptionForm on the SkillRelationManager form. At the risk of embarrassing myself, here's the code that I am work with.
---
34 replies