Skip to content

Laravel 5.6 – New @method and @csrf Blade Directives

Last updated on February 17, 2018

Laravel is gonna introduce two new Blade Directives as part of 5.6 release, @method and @csrf Directives.

In the current Laravel 5.5 version, we are doing the following at the top of forms to create hidden inputs for the CSRF token and the spoofed HTTP method –

{{ csrf_field() }} {{ method_field('PUT') }} ..... ....... ......

In the Version 5.6, you can use new Blade Directives as shown below to create hidden inputs for the CSRF token and the spoofed HTTP method

@method('put') @csrf ..... ....... ......

Below is the reference link –
https://github.com/laravel/framework/commit/5f1984421af096ef21b7d2011949a233849d4ee3

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments