George
George

Reputation: 23

Laravel welcome.blade page displays code

A few days ago I posted here a question about the fact that I had a project only displaying code on the browser, even though I had helpful answers I couldn't reach the needed solution, so I took a break.

Today, after reinstalling composer and artisian (They were having errors before, but now they are working properly, I supose), I decided to create a new empty project. It worked all fine, the project was crafted, I updated the composer to make sure it was all good, but when I opened the welcome.blade.php view, which usually shows the default laravel page, It was displaying code from the body. I checked the documentation from laravel and It seems that it has all the necessary extensions from php.

Here's an image of what it shows (cant upload here because, reputation)

Is it possible that I missed the instalation of some extension?

Thanks in advance

Upvotes: 1

Views: 2178

Answers (2)

Janje
Janje

Reputation: 21

Make sure that the filename of you blade is xxxxx.blade.php I copied an old blade and quickly renamed and forgot the blade part. I know this is old, but I google seached to here today.

Upvotes: 2

Ian
Ian

Reputation: 3666

You are going directly to a blade file, your browser simply interprets this as HTML as it is not compiled.

In your controller you want to return the view by using

view('view.name')

You are coming across expected behaviour since the view hasn't been compiled yet and PHP won't understand @ tags

Upvotes: 1

Related Questions