Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Blade: @endsection vs @stop

In Laravel Blade, we can basically do this:

@section('mysection')  @endsection   @section('mysection')  @stop 

What is the difference between @stop and @endsection?

like image 675
user1995781 Avatar asked Jan 18 '14 02:01

user1995781


2 Answers

The @endsection was used in Laravel 3 and it was deprecated in Laravel 4

In the Laravel 4 to end a section you have to use @stop

You can refer the Changelog here http://wiki.laravel.io/Changelog_%28Laravel_4%29#Blade_Templating

like image 140
Achintha Samindika Avatar answered Oct 05 '22 22:10

Achintha Samindika


Both @endsection and @stop works.

In Laravel 4 it seems that only @stop is supported 1. But from Laravel 5 onwards @stop is not even mention in the documentation 2.

So I would suggest to use @endsection.

See:

  • Laravel 4 Blade Documentation
  • Laravel 5.7 Blade Documentation (current stable)
like image 34
s3.huber Avatar answered Oct 05 '22 22:10

s3.huber