How do I pass a variable to the layout using Laravel' Blade templating?

If you're using @extends in your content layout you can use this:

@extends('master', ['title' => $title])

Note that same as above works with children, like:

@include('views.subView', ['my_variable' => 'my-value'])

Usage

Then where variable is passed to, use it like:

<title>{{ $title ?? 'Default Title' }}</title>

For future Google'rs that use Laravel 5, you can now also use it with includes,

@include('views.otherView', ['variable' => 1])