-
So I have this relation manager, each Babies has many Visits In New Visit form, there is a
Instead of using constant value I hope this isn't confusing. If it is, ignore everything above, this is the query that I'm trying to achieve, maybe it could help
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Do you have a visits relationship? TextInput::make('kunjungan')
->label('Number of visits')
->formatStateUsing(fn ($record): ?string => $record?->visits->count() ?? 0)
->disabled() |
Beta Was this translation helpful? Give feedback.
-
Found the solution from this Laracasts post
|
Beta Was this translation helpful? Give feedback.
-
Anothers suggestions when it depends on the context (ownerRecord can not exist) ->default(function ($livewire) {
if (isset($livewire->ownerRecord)) {
return $livewire->ownerRecord->id;
}
}
)
->disabled(function ($livewire) {
if (isset($livewire->ownerRecord)) {
return true;
}
return false;
})
``` |
Beta Was this translation helpful? Give feedback.
Found the solution from this Laracasts post