How can I capture Sessions Data?

BulkAction::make('sendProducts')
->action(function (Collection $records, array $data) {
$barcodeNumbers = $records->pluck('barcode_number');
return redirect()->route('filament.resources.order-exits.create', ['barcode_numbers' => $barcodeNumbers])
->with('barcode_numbers', $barcodeNumbers);
})
BulkAction::make('sendProducts')
->action(function (Collection $records, array $data) {
$barcodeNumbers = $records->pluck('barcode_number');
return redirect()->route('filament.resources.order-exits.create', ['barcode_numbers' => $barcodeNumbers])
->with('barcode_numbers', $barcodeNumbers);
})
I send data to a different page in this way, how can I capture it with session on the other page?
Select::make('product_order_id')->label('Ürün Seçiniz')
->options(ProductOrder::query()->where('customer_id', Auth::user()->customer_id)->where('warehouse_status', 1)
->where('barcode_number',session('barcode_numbers'))->pluck('producer', 'id'))
->required(),
Select::make('product_order_id')->label('Ürün Seçiniz')
->options(ProductOrder::query()->where('customer_id', Auth::user()->customer_id)->where('warehouse_status', 1)
->where('barcode_number',session('barcode_numbers'))->pluck('producer', 'id'))
->required(),
I tried it this way but it didn't work.
5 Replies
krekas
krekas2y ago
don't see where you set session first
Mehmet K.
Mehmet K.OP2y ago
I haven't set up a session. I wonder how I should set it up.
Dennis Koch
Dennis Koch2y ago
I think ->with() only flashes the data, which means they are available only once. The form schema might be retrieved multiple times. So switch to session() helper. Also wrap options a. Closure options(fn () => ProductOrder
Mehmet K.
Mehmet K.OP2y ago
Select::make('product_order_id')
->label('Ürün Seçiniz')
->options(fn() => ProductOrder::query()
->where('customer_id', Auth::user()->customer_id)
->where('warehouse_status', 1)
->whereIn('barcode_number', Session::get('barcode_numbers'))
->pluck('producer', 'id'))
->required(),
Select::make('product_order_id')
->label('Ürün Seçiniz')
->options(fn() => ProductOrder::query()
->where('customer_id', Auth::user()->customer_id)
->where('warehouse_status', 1)
->whereIn('barcode_number', Session::get('barcode_numbers'))
->pluck('producer', 'id'))
->required(),
BulkAction::make('sendProducts')->label('Seçilen Ürünleri GÖnder')
->action(function (Collection $records, array $data) {
$barcodeNumbers = $records->pluck('barcode_number');
Session::put('barcode_numbers', $barcodeNumbers);
return Redirect::route('filament.resources.order-exits.create', ['barcode_numbers' => $barcodeNumbers]);
})
BulkAction::make('sendProducts')->label('Seçilen Ürünleri GÖnder')
->action(function (Collection $records, array $data) {
$barcodeNumbers = $records->pluck('barcode_number');
Session::put('barcode_numbers', $barcodeNumbers);
return Redirect::route('filament.resources.order-exits.create', ['barcode_numbers' => $barcodeNumbers]);
})
I updated it this way, but I couldn't catch it again strangely.
krekas
krekas2y ago
first check if your $barcodeNumbers is evenn assigned
Want results from more Discord servers?
Add your server