I have error 404 when you quick reload the page laravel?

Here is the code of the controller api routes
$game = Game::with('users')->findOrFail($request->input('gid'));
 $p1 = $game->users()->where('pnum', 1)->first();
 $p2 = $game->users()->where('pnum', 2)->first();
 if($p1 && $p2)
 return response()->json([
 'p1' => $p1->id,
 'p2' => $p2->id,
 'status' => $game->status,
 return abort(404);

In Game model is defined
public function users()
 return $this->belongsToMany('App\User');

The connection table has an additional parameter $table->integer('pnum');
The problem is that if I quickly press two times the F5(to reload), the page gives a 404, if you just turn the page gives a normal response. How to deal with it?
March 25th 20 at 12:40
2 answers
March 25th 20 at 12:42
It is likely the configs
Takeshiro config and ranting:
php artisan config:cache
php artisan routes:cache
March 25th 20 at 12:44
You have a SPA? Some vue router? It turns out if you go on the page - you have to work out the router front, if you just go on this lesson/update page that fulfills the router Caravela, and this page had not. Ie if you are using some front-end router, you need to configure the server so that all pages went to the home, and its already treated the front.
No, ranting for the backend - Caleigh.Barte commented on March 25th 20 at 12:47

Find more questions by tags Laravel