mardi 5 mai 2020

Cannot pass full array from controller in laravel to a view using redirect()

I am unable to solve passing of array issue

below is my function in controller

public function fetchData($id)
{ 
    $id=base64_decode(urldecode($id));
prod_detail=ProductDetail::select('prod_id','supplier_id','price','open_stock','discount_rate','min_order_level')->where('prod_id','=',$id)->get();
    return redirect()->route('prod_d_view', compact($prod_detail));
}

below is my route

Route::get('/product_view', function(){
    return view('/admin/product_d_mgt');
})->name('prod_d_view');

below is my error

Undefined variable: prod_detail (View: \admin\product_d_mgt.blade.php)

I am unable to pass the full array from one controller using redirect()->route() to another view



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire