Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel blade variable not working

Heres the controller:

class HomeController extends BaseController {
    public function index() {
        return View::make('home', array('username' => 'Vaughan'));
    }
}

Here the home blade view:

{{ $username }}

Yet the view is outputting exactly this:

{{ $username }}

The variable is not being rendered. Could this be something to do with Apache or PHP?

like image 608
Wancieho Avatar asked Dec 26 '22 10:12

Wancieho


1 Answers

You need to name your view with blade extension:

home.blade.php

That's all.

like image 65
Jarek Tkaczyk Avatar answered Jan 13 '23 20:01

Jarek Tkaczyk