Action form how send data ?

Hello this is my problem, i try to send the select data to the action but in the dd() show like id of array not the id of the article selected some ideas ? Tables\Actions\Action::make('pdf_2') ->form([ Forms\Components\Section::make() ->schema([ Forms\Components\Select::make('kits') ->options( function ($record) { return InvoiceItem::where('order_id', $record->id)->pluck('article_id'); } ), ]), ]) ->action(function (Order $record, array $data) { $kit = $data['kits']; dd($kit); }),
No description
No description
Solution:
pluck('article_id', 'article_id')
Jump to solution
7 Replies
NoxyArg
NoxyArgOP8mo ago
bump
awcodes
awcodes8mo ago
pluck(‘article_name’, ‘article_id’) If this is a relationship then you can also use the ->relationship() modifier instead of ->options() might make it easier.
NoxyArg
NoxyArgOP8mo ago
Tnx for the reply ! ,In this case don't have relationship, but there is no problem with that, the problem is that it would not be passing the selected id, it only gives me the position of an array of the ids that are to be selected, I don't see what I'm doing doing wrong :S for example if selected the first(13) , the dd() show "0" and if selected the second(9) show "1" like the screenshot , I'm sure it's nonsense but I can't figure it out. :squint:
Solution
Saade
Saade8mo ago
pluck('article_id', 'article_id')
NoxyArg
NoxyArgOP8mo ago
excellent thanks !! , Sorry for my ignorance and why is it like this?
Saade
Saade8mo ago
Thats how Laravel's pluck works 🤷‍♂️
NoxyArg
NoxyArgOP8mo ago
tnx !
Want results from more Discord servers?
Add your server