You can pass variables like this
// BaseController
protected $data = array();
// Controller
$this->data = array(
'variable' => $variable,
// ...
);
return View::make('example', $this->data);
If I did it that way I would be writing hundreds of variables in the array. What I did before laravel is use require_once(file) to use the variables in that file on the current page.
Do your Stats calculation in a Class who you can access your needed Variables over it. Then you can only Pass the Class to your View.
I have a sneaking suspicion that if you're trying to send hundreds of files to a view, you should organize your code a bit differently. I can't imagine a scenario where I need to display hundreds of pieces of data that wouldn't warrant organizing them into arrays, collections, or objects with properties.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community