I have problem with getting cookie which I saved earlier. I want to pass it through controller to view. Here is my cookie saved in jQuery (it works, checked).
$('.wybierz').on('click',function(){
var id = $(this).attr('name');
Cookies.set('chosenComp', id);
highlightChoice(id);
});
and here is my controller
public function index(Request $request){
$cookie = Cookie::get('chosenComp');
$actualComp = $cookie;
$coms = DB::table('items')->get();
$teams = DB::table('results')->get();
return view('nowa_druzyna',['teams'=>$teams],['coms'=>$coms])->with('actualComp',$actualComp);
}
First of all I just wanted to try passing the cookie which is a number but it doesn't show. My view
<option selected class="showCurrentComp" id="">{{$actualComp}}</option>
Javascript存储原始cookie,Laravel希望对cookie进行加密,您可以从EncryptCookies中间件中免除cookie
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.