user3140464
user3140464

Reputation: 67

Route won't return view Laravel

I'm trying to build an API with Laravel. I already did some projects with this framework but never had this kind of issue I'm dealing with now. In the picture you see my routes which I have build.

The first one just opens the Laravel welcome page, the second returns all my users in json.

But in the last route I simply want to return a view I just created, but when visiting the URL I just get a blank white page with no content, error message or log.

I simply added a new newuser.blade.php view in my views folder.

http://i61.tinypic.com/311nt5g.png

Upvotes: 0

Views: 2430

Answers (1)

benJ
benJ

Reputation: 2580

Code would help, although from the picture you simply need to move your users/new route to above the users/{id} one.

Laravel is passing 'new' as the $id parameter to UserController@UserById. Changing the order means it will recognise the other route first.

    // above
    Route::get('users/new', function() {
        // return view
    });

    // below
    Route::get('users/{id}', 'UserController@UserById');

Upvotes: 3

Related Questions