Answer the question
In order to leave comments, you need to log in
Why is there a 404 error when fast reloading a laravel page?
Here is the route api controller code
$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,
]);
else
return abort(404);
public function users()
{
return $this->belongsToMany('App\User');
}
Answer the question
In order to leave comments, you need to log in
The point is most likely in the configs
. Cache the config and routes:
php artisan config:cache
php artisan routes:cache
Do you have SPA? Any vue router? It turns out that if you go through the pages, the front router works for you, if you just follow this lesson / update the pages, then the Laravel router works, but it does not have such a page. Those. if you use some kind of frontend router, you need to configure the server so that all pages are sent to the main one, and the front is already processing it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question