Set body id/class from child view

Submitted by xsbeats - 8 years ago

I like to set body id/class from within the child view (for css purposes). Previously I was passing this information to the view from the controller but decided I didn't like that, so I came up with this.

// default layout (parent)
<body id="@yield('body-id', '')">

// child view(s)
// using {{ }} to avoid having to have space before @stop which will show up in html
@section('body-id'){{ 'home' }}@stop