Problem
You want to start section to your Blade template.
Solution
Use the @section blade command.
This will start injecting content into the section. This will continue until a @stop, @show, @overwrite or @append statement is reached.
For example, the following block won't output anything, but will track I Am Legend under the movies section.
@section('movies')
I Am Legend
@stop
Alternatively, you could use the following syntax to achieve the same thing.
@section('movies', 'I Am Legend')
There's no need to end the section with @stop when you provide the content with the second argument.
Later, a @yield('movies') would output the contents of the movies section.
@yield('movies')
Discussion
Sections always begin with @section.
And, except for the syntax where you provide the content as the second argument, a @section must always end one of five ways.
- With a
@stopcommand. See Stopping Injecting Content Into a Section. - With a
@endsectioncommand, which is an alias for@stop. - With a
@showcommand. See Yielding the Current Section in a Blade Template. - With a
@appendcommand. See Stopping Injecting Content into a Section and Appending It. - With a
@overwritecommand. See Stopping Injecting Content into a Section and Overwriting.
