Haring10 Haring10 - 4 months ago 25
PHP Question

Laravel 5.2 Only one specific route not found, but it does exist

No matter what I try, the route

/authenticate/{code}
returns a
NotFoundHttpException
.

My route in routes.php:

Route::get('/authenticate/{code}', ['as' => 'authenticate', 'uses' => 'FrontendController@getAuthenticate']);


When I am calling the route:

URL::route('authenticate', $code)


On my local machine it runs it just fine, but on my production server, it takes me to a
NotFoundHttpException
page.

It does site inside of the
web
middleware group.

I have tried (with no success):


  • resetting the github repo on the server (fresh install)

  • composer update

  • php artisan cache:clear

  • php artisan view:clear

  • php artisan route:clear

  • php artisan config:clear

  • composer dump-autoload

  • changing the route from
    authenticate
    to
    authenticate-email



What could it be? Every other route on the site works, it is just this one that doesnt.

Answer

The only thing I can think to advise is switching from using the URL Facade to using the built in helper function $url = route('authenticate', ['code' => $code]); I only say this because I can't seem to find in the docs how you hint at URI parameters when using URL::route() :)