Data passed to view, not accessible in layout - Laravel Controllers

Viewed 4932

If I have this in my controller

$this->layout->nest('content', 'home.index', $array);

I can only access the data in $array inside the home.index.blade.php template file, and NOT in the layouts.main that I am using.

The layout & the view load correctly, I just cannot access any data passed in a controller from the layout file.

Anyone out there that can help?

To Clarify - Say I wanted to pass a title variable to my layout.main, how would I go about it? the method I posted above only allows me to access $array from within the 'content' of index.blade.php

2 Answers
Related