Let's say, i have a view called: backend.blade.php. And in that view i want to display all users and posts. Users have their own model, same with Posts. Can i share variables across views?
// UserController.php
View::make('backend')->with('users', $users)->with('posts', $posts);
Hi Heihachi, Maybe I'm misunderstanding your question, but can't you just do:
$users = User::all();
$posts = Post::all();
View::make('backend')->with('users', $users)->with('posts', $posts);
Maybe that is already what you are doing?
"Can i share variables across views?" -> Use View::share()
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community