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

If I understand you correctly, you have a controller working, and you want to pass a variable to the views? If this is the case, using the "with" method on the view() should work.. look at the section called "Passing Data To Views" on http://laravel.com/docs/master/views

It says:

// Using conventional approach
$view = view('greeting')->with('name', 'Victoria');

// Using Magic Methods
$view = view('greeting')->withName('Victoria');

So, in your case, inside of your controller, you would want to do:

return view('info')->with('myteam', 'Team Name');

This will expose the $myteam variable to the views that are called.

Last updated 9 years ago.
0

Thanks Gercoli, that's it!

No criticism of anyone involved but there's something about the Laravel documentation and even the screencasts which isn't quite right for me as a true MVC novice. Since your reply I've found this guide which I have found to be the most accessible and well explained to give me a 'way in' to Laravel: http://daylerees.com/codebright/responses

0

Sign in to participate in this thread!

Eventy

Your banner here too?

dgravy dgravy Joined 9 Mar 2015

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.