php - Laravel 5.1 create 5 minute cookie then return view -


i want set 5 minutes cookie return view,

but if use view in response, cookie loses. , when index page, can't see cookie. because lost.

but if return response without view, works perfectly.

$response = new illuminate\http\response(); return $response->withcookie(cookie('yes', 'value', 5)); 

this works perfectly.

but not:

$response = new illuminate\http\response(view('somepage')); return $response->withcookie(cookie('yes', 'value', 5)); 

how can create view after set cookie?

here go:

use illuminate\http\request; use illuminate\cookie\cookiejar;  class newclass {     public function handle(request $requestval, cookiejar $cookieval)     {         $cookieval->queue(cookie('yourcookie', $requestval->value, 5000));         return redirect('somepage');     } } 

Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -