Best way to generate page titles?

Posted 1 year ago by Boubou


I would like to know what is the best way of generating page titles in Laravel please. I understand how to do it in pure PHP but with Laravel I am a bit lost.

For example, you have a main layout file, inside the layout file you have partials, if a partial shows content "XYZ" and that in this content I have already a field "title", how can I pass this $data->title that may come from multiple controllers to the main layout file, this is the part that confuses me.

I hope I explain it correctly:-)


Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.