auth()->user-> not filled in form

I have an issue with username not being filled neither with deafult() or reactive(). It looks like auth()->user()->name not being used at all. There is no error whatsoever shown, just data being ignored. Currently i am filling those with mutateFormDataBeforeSave, but i would like to have it in form directly.

Forms\Components\Checkbox::make('checked') ->label('Checked') ->reactive() ->afterStateUpdated(fn ($state, callable $set) => $state === true ? $set('checked_by', auth()->user()->name) : $set('checked_by', null)) ->afterStateUpdated(fn ($state, callable $set) => $state === true ? $set('checked_time', now()->toDateTimeString()) : $set('checked_time', null)),

Checked time works as it should, i have issue only with checked_by field.
Solution
you can chain ->disabled()->dehydrated() to make it return
Was this page helpful?