Alisha Lamichhane
Alisha Lamichhane

Reputation: 514

Get route not found in laravel

I have registered get route like below:

Route::get('/user/verify?email={email}&token={token}', 'UserController@verifyEmail');

But when I try to access this route with the following:

website.com/user/[email protected]&token=38757e18aad8808832ace900f418b03763789755

It says 404 not found. What is wrong here?

Upvotes: 0

Views: 69

Answers (2)

pjplonka
pjplonka

Reputation: 95

You can run php artisan route:list in your console and check how exatctly every route looks like.

Query params like that: ?email={email}&token={token} in this url: '/user/verify?email={email}&token={token}' are ignored by laravel router.

Upvotes: 0

STA
STA

Reputation: 34678

your route would be :

Route::get('/user/verify', 'UserController@verifyEmail'); 

Now can access :

website.com/user/[email protected]&token=38757e18aad8808832ace900f418b0376378975

In your controller you can get the parameter value like that :

public function show(Request $request)
{
   $email = $request->email ?? null;
   $token = $request->token ?? null;
}

Upvotes: 1

Related Questions