I have been working with session in web controllers but never tried in api controllers.I want session works in api controllers.
here is my method in Api/TestController
public function setSession(Request $request){
// session()->put('hellos','rfer');
if(session()->has('hellos')){
return response()->json(true);
}
else{
return response()->json(false);
}
}
if I comment session->put().. The method return false.
Then I tried to register in Kernel.php like that
'api' => [
'throttle:60,1',
'bindings',
\Illuminate\Session\Middleware\StartSession::class,
],
But I still don't get what i want. I want to set the session value from api controller for all routes of my project.