I have a problem understanding how variables work inside the Laravel templating system, Blade. I set the variables in the controller, I can see them in the first view I make, but not inside the next one.
I'm using a master.blade.php file that holds the header and footer of the page, yielding the content in the middle. I can use the variable inside the master.blade.php file, but not inside the content blade file (variable undefined).
For example, for the contact page:
CONTROLLER FUNCTION:
$this->data['page'] = "contact";
$this->layout->content = View::make('pages.contact');
$this->layout->with('data', $this->data);
MASTER.BLADE.PHP:
if ($data['page'] == 'contact')
{ //do something, it works }
@yield('content')
CONTACT.BLADE.PHP:
if ($data['page'] == 'contact')
{// do something. ErrorException Undefined variable: data}
Am I missing something or is it a known restriction?
Thanks!