In Laravel 5 I have a master template containing:
<title>@yield('title') | Site Name</title>
And in my view I have:
@extends('master')
@section('title', $client->name)
...
The problem is, the @yield does not escape the data passed to it. So far, the only solution I've found is to manually escape the data like so:
@section('title', e($client->name))
Is this the best method? It means I have to manually escape data on every view that I use a variable. I don't see a way to escape the @yield directive from the master template - using {{ }}
or e()
around the @yield doesn't work.
@yield
-ed values weren’t escaped. Thanks for pointing that out! – Polad