user3677636
user3677636

Reputation: 651

Laravel 5.1 routing returning wrong content from controller

I have this really weird problem with laravels routing.

I started to make some routes and controllers and just returning strings from each controller confirm that it worked.

And everything did work.

Now when i started making the master view and putting it together with some templates for the routes I noticed that the string that laravel returns isn't the string i wrote.

All routes return "This is routename page"

The only routes that actually work as expected is the routes with wild cards, and the route going to the start page. Those routes return the correct strings.

Example routing

    Route::get('/users', 'UserController@index');

    class UserController extends BaseController {

        public function index() {
            return 'List of users!';
    }

});

This routing displays "This is user page" (NO ERROR)

I have tried returning the string directly from the route, clearing all the cache files i could find including route cache, restarting browser and MAMP

Just to be clear, the routing returned the correct strings when I made the route.

I have installed Elixir to compile my scss files, but i doubt that should have anything to do with my problem.. :(

Upvotes: 0

Views: 225

Answers (1)

user3677636
user3677636

Reputation: 651

Figured it out just after I posted the question!

I had a route with a wildcard directly after the root

    Route::get('/{'user'}); 

This route were overriding all other routes that only had one parameter after the root. So if I go to the url "/users" the route will assume it is a wildcard and send it to another controller that returns the string "This is {wildcard} page!", Brainfreez! :P

Upvotes: 1

Related Questions