Disable the CSRF token in Laravel 5

Just a #HTH

Often when you’re devving’ forms in Laravel a quick refresh of the page rightly errors on the CSRF token. This is a bit of a bummer if you want to keep testing the same request, so all I do is…

Goto App/Http/Kernel.php and comment out,

// 'AppHttpMiddlewareVerifyCsrfToken',

Then you can dev to your heart’s content, just remember to un-comment it! Maybe write a unit test to check it’s on before allowing you to push or create a merge request. Like one that alters the hidden field and submits.

Author: Dan Course

Dan Course, E-Learning Development at Warwick University (WMG). Agile Scrum trained and full-stack development. Interested in E-learning, Democracy, Politics and Tech. All thoughts are mine and not of my employer.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s