I want to limit logged-in user from refreshing a certain page multiple-times (e.g. repeated pressing of F5 key). Is there any other simpler way other than counting the number of refresh and saving it on the database like this?
public function myPage()
{
// Page is a table storing refresh count of pages
$page = Page::where('user_id', Auth::user()->id)->get();
$refresh_count = $page->refresh_count;
if($refresh_count > 10){
// logout user
}else{
$refresh_count = $page->refresh_count + 1;
$page->update(['refresh_count' => $refresh_count]);
}
return view('mypage');
}