Laravel remembers that login cannot be written to Cookie.

if (!Auth::attempt(["email" => $data["email"], "password" => $data["password"]], true)) {
            return response()->json(["code" => 201, "data" => null, "msg" => ""]);
        }
Cache::put(Auth::user()["user_id"], 120);
var_dump(Cookie::get());die;

after logging in, remember_token is not written in the browser

clipboard.png

excuse me, did I write something wrong? Or which files are not configured

Mar.11,2021

setcookie ('user_id',Auth::id (), time () + 3600 24 7 pointer');


first of all, Cache::put is put into cache, not set cookie
secondly, set cookie to be used with response

return response()->json([])->withCookie(Cookie::make('userId',$userId,120))
Menu