Dan Knights
Dan Knights

Reputation: 8368

Laravel Route not displaying page properly

I'm currently learning Laravel, very new to it.

I have two routes setup like so:

Route::get('/', function () {
    return view('welcome');
});

Route::get('/about', function () {
    return view('pages.about');
});

In the 'pages.about' file I've inputted an <h1> with some random text to test it, however, when I navigate to that page in localhost all I get is a white page with the number '2' displayed. No errors, just '2':

display page

Any ideas as to why this is happening?

File-tree if needed:

file-tree

EDIT

about.blade.php:

kjnksjndkjnsdc
<h1>ijsoijsoijs</h1>

Upvotes: 2

Views: 813

Answers (4)

Dan Knights
Dan Knights

Reputation: 8368

Not sure what the problem was but I reset the project from scratch and it's now working. Luckily, I wasn't too far in to delete the entire project.

Upvotes: 0

Arshak Ahamed
Arshak Ahamed

Reputation: 113

Try to execute command php artisan view:clear and php artisan route:clear

Upvotes: 2

George Matsov
George Matsov

Reputation: 11

Route is ok. Folder structure is ok too. Is this a blank project? Did you change someting in some other folders?

Because I try this on my PC and works fine

Upvotes: 1

zaman
zaman

Reputation: 3

instead of return view just echo something like

Route::get('/about', function () {
    //return view('pages.about');
     echo "laravel";
});

check it again using ctrl+f5 key if there any cache issue is same result show then change the method from get to post again try it if it shows properly the echo then go to your about page and give the proper html structure

Upvotes: 1

Related Questions