How to use action and form in beforecreate() the record
protected function beforeCreate(Form $form, $record): void
{
$user_id = Franchisee::find(Session::get('current_franchisee'));
$student = $this->record->doj;
$this->record->update([
'doj' => Carbon::now(),
])
->action(function ($record, array $data): void {
$record->save();
Notification::make()
->title('Employee declined successfully!')
->success()
->send();
})
->requiresConfirmation()
->modalHeading('Employee Decline')
->modalSubheading('Please enter the reason to decline !')
->form([
Textinput::make('program_id')
->rows(3)
->cols(1)
->required()
->label(''),
]);
}
its is correct way to approach this function Can you advise me how to do ....2 Replies
$this->form
. the record isnt created yetokay