I'm Create a API with Lumen Using JWT, then the request set to GET this method show the detail about the data like reading page
I try to using Session Like Laravel but it's not working, and i know Lumen not using session + i using JWT token for authentication and this my code
public function show($storyId, $id)
{
$part = Story::find($id)->parts()->withCount('comments')->first();
$link = 'story/'. $storyId.'/part/'.$id;
if (!Session::has($link)) {
$part->increment('viewers');
Session::put($link,1);
}
return response()->json($part);
}
so every request method GET call it increment the viewers during the token not expired, or like youtube viewers as long as browser not closed if i wrong to write a code or implement the code please suggest me for effective code