I’m working on a Laravel and need help setting global variables. I want to use the variable for all blade templates. I have tried the below code, it’s working on a direct view template called from the controller but inside view the @extends layout, it’s not working.
However, you can use 'layouts.*' , it uses a wildcard, meaning it will match any blade template within the ‘layouts’ directory. This includes ‘app’ and any other templates you might have.
If ‘layouts.app’ does not work try wildcard 'layouts.*'