here I'm trying to store key
$code = mt_rand(111111, 999999);
Cache::put('notification', $code, 600);
and in another function I try to get that key in this way
if(Cache::has('notification') and Cache::get('notification') == $request->code)
return response()->json(['status' => true, 'group' => $request->res['group']]);
else
return response()->json(['status' => false, 'message' => 'کد اشتباه است']);
but it always return false