Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Pass data to views that use same layout

Hello. I was wondering what could be a good solution to pass data to views that use same layout? For instance let's say That I have HomeController and SigninController and they both have the same layout. Would it be an overkill if I would create a BaseController for those controllers that use the same layout and for the controllers that use different layout - another base controller? Or it is better to do it within an initiliazile function of each of the controllers ? Or maybe another solution would be cleaner ? Thanks in advance



1.8k
Accepted
answer

What kind of data? How many controllers need to access the data? Could you store it in the session?



17.6k

I totally forgot that it could be done with session. Thanx :) My bad. A silly question

No such thing as a silly question :) Glad to help!