On his blog, Sebastian De Deyne, shares a quick tip on how to pass data to a layout in Laravel.

Laravel quick tip! The @extends Blade directive accepts a second (undocumented) parameter to pass data to the parent layout.

https://sebastiandedeyne.com/posts/2018/passing-data-to-layouts-in-blade-through-extends