F
Filamentβ€’6mo ago
mamamia

Visible On Edit

how do i make input visible only on edit with the $record->status = true?
Forms\Components\Select::make('project_manager_id')
->label(__('Project Manager'))
->visibleOn('edit')
->searchable()
->options(fn() => User::all()->pluck('name', 'id')->toArray())
->default(fn() => auth()->user()->id)
->required(),
Forms\Components\Select::make('project_manager_id')
->label(__('Project Manager'))
->visibleOn('edit')
->searchable()
->options(fn() => User::all()->pluck('name', 'id')->toArray())
->default(fn() => auth()->user()->id)
->required(),
6 Replies
JC
JCβ€’6mo ago
->visible(fn(?Model $record) => $record->status) try this
mamamia
mamamiaβ€’6mo ago
thank you for your answer but when i tried it "visible" is not working when there is "visibleOn", so how do i know its on edit inside "visible"?
Matthew
Matthewβ€’6mo ago
try: ->visible(fn ($livewire, $record) => $livewire instanceof EditRecord && $record->status) This should work πŸ™‚
mamamia
mamamiaβ€’6mo ago
Awesome! it worked perfectly
Matthew
Matthewβ€’6mo ago
perfect
Want results from more Discord servers?
Add your server
More Posts