How to run a function after adding new data using createOptionForm()
I want to inser data in pivot table after new data is save.How can I do that?here is my code .
Forms\Components\Select::make('location')
->label('Location')
->multiple()
->relationship('locations','location_name',fn (Builder $query) => $query->where('company_id', Auth::user()->current_company_id))
->preload()
->createOptionForm([
Forms\Components\TextInput::make('location_name')
->required(),
Hidden::make('company_id')
->default( Auth::user()->current_company_id)
]),
4 Replies
->createOptionAction()
how can I get the id of that created data?
sorry its
createOptionUsing
π
@Lara Zeus I cant get the id of the newly created location is there other functions that works like with afterCreate()?with that I can get the record->id