how to set the data from input to a form modal

USING FORM & ACTION BUILDER Hi i have a permission tags input and i also have action inside that input the open a modal and from the user can select the permision and the they will see it in tags input i can set the permission to the tags input from the modal but when i open the modal the permission are alway unchecked how can i set the permission form the tags input the the selected permission are checked my code
public function mount()
{
$this->form->fill(['permissions' => 'can:edit', 'can:create'])
}

public function form(Form $form): Form
{
return $form->schema([
TagsInput::make('permissions')
->hintAction(
Action::make('add_permissions')
->form([
CheckboxList::make('permission_name')
->options($this->permissionsNames)
])
->icon('fal-plus')
->action(function (Set $set, $data) {
$set('permissions', [
...$data['permission_name']
]);
})
)
}
#[Computed(persist: true)]
private function permissionsNames(): array
{
return Permission::whereIsGlobal(false)
->pluck('name', 'name')
->toArray();
}
public function mount()
{
$this->form->fill(['permissions' => 'can:edit', 'can:create'])
}

public function form(Form $form): Form
{
return $form->schema([
TagsInput::make('permissions')
->hintAction(
Action::make('add_permissions')
->form([
CheckboxList::make('permission_name')
->options($this->permissionsNames)
])
->icon('fal-plus')
->action(function (Set $set, $data) {
$set('permissions', [
...$data['permission_name']
]);
})
)
}
#[Computed(persist: true)]
private function permissionsNames(): array
{
return Permission::whereIsGlobal(false)
->pluck('name', 'name')
->toArray();
}
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server