return redirect with data in laravel code example

Example 1: redirect to route laravel

Route::post('/user/profile', function () {
    // Update the user's profile...

    return redirect('/dashboard')->with('status', 'Profile updated!');
});

Example 2: redirect to url with post data laravel

return redirect()->route('home');

Example 3: return redirect with message laravel

Route::post('user/profile', function () {
    // Update the user's profile...

    return redirect('dashboard')->with('status', 'Profile updated!');
});

Tags:

Php Example