mshakeel

In Laravel 5.1, you can exclude URIs from CSRF protection by simply adding them to the $except property of the VerifyCsrfToken middleware:

<?php

namespace App\Http\Middleware;

use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;

class VerifyCsrfToken extends BaseVerifier
{
    /**
     * The URIs that should be excluded from CSRF verification.
     *
     * @var array
     */
    protected $except = [
        'api/*',
    ];
}

Documentation: http://laravel.com/docs/5.1/routing#csrf-protection http://stackoverflow.com/questions/26992885/laravel-5-post-whithout-csrf-checking/32902801#32902801

Return to Thread...