I am passing a variable named $customer to a view. I can use Blade to display the data using {{ $customer->name }} inside the current view, that works great.
But I have a section that connects to the master template file, using it to set a H3 header and also the pages <title> in the master file.
In my show.blade.php:
@section('title', '{{ $customer->name }}')
@section('title_header', '{{ $customer->name }}')
In master.blade.pho:
<title><title>@yield('title') </title></title>
<h3 class="title">@yield('title_header')</h3>
The output in browser is just:
name); ?>
This way from any controller method I can pass an array meta with whatever meta tags I want to populate into the header of the page.. so like meta description, meta keywords, canonical link, etc.. the page specific view just ignores that, generally.. but the variable then gets passed up and made available to the layout template.
You could also then do something like this in your layout's header: