Support the ongoing development of Laravel.io →
Database Views
Last updated 2 years ago.
0

You can pass variables like this

// BaseController
protected $data = array();

// Controller
$this->data = array(
    'variable' => $variable, 
    // ...
);

return View::make('example', $this->data);
Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

tyr5577 tyr5577 Joined 27 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.