Sunday, March 19, 2017

Laravel setting a cookie then redirect to home

I have a piece of code which should set a cookie then redirect to home, the setting cookie part seems to be missed. What could be the issue?

Route::get( '/r/{ref}', function($ref){
    $response = new Illuminate\Http\Response();
    $cookie = Cookie::make('ref', $ref);
    return Redirect::to('home')->withCookie($cookie);
});



via Omar Lers

Advertisement