php - Laravel redirect with variable

Solution:

Try the following

redirect()->route('dashboard')->with('list', $list);

for more info follow https://laravel.com/docs/8.x/redirects

Answer

Solution:

First be sure that list load some data with dd($list); After use redirect helper like

$list = //...;
return redirect()->route('dashboard', ['list'=>$list]);

you can use closure function in the route in web.php and inspect if the data is bind through the route like

Route::get('/dashboard/{list}', function($list){
   dd('list');
})->name('dashboard');

Source