Laravel To Do App: VIEW COMPOSER TO PASS COMMON VARIABLES (18/25)

Laravel To Do App: VIEW COMPOSER TO PASS COMMON VARIABLES (18/25)



In this video, we will create protected common variables & set them in our constructor of Project Controller class & then we will make use of helper View::share static method to pass them along to each and every view created in this class. This way we can abstract repeatedly called common variables & make our project controller more modular.

Source code is hosted on GitHub:
https://github.com/simplewebteam/laravel-todoapp-starter.git

Please subscribe, share & hit the like button.

Twitter: https://twitter.com/learn_by_exampl
Buy me a coffee: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=HH49LF3J9G9QL

source

2 comments

  1. I'm a total laravel noob and have been trying to figure out how to simply pass basic variables across multiple views for testing purposes… I've looked at the laracasts, view composers, app provider methods, etc. Couldn't get ANY to work.

    Your tutorial solved my problem in 5 minutes. Dude… thank you.

Comments are closed.