mercredi 5 octobre 2016

Excluding routes using regex from verifying CSRF token

I want to exclude any routes starting from admin from verifying CSRF token.

This is how it declared in routes/web.php

Route::post('/admin', 'AdminController@index');
Route::post('/admin/check', 'AdminController@check');
Route::post('/admin/test/{testId}', 'AdminController@test');

In VerifyCsrfToken I updated as following

protected $except = [
    'admin/*'
];

Which is not working, I'm getting TokenMismatchException

When I try like below it worked

protected $except = [
     'admin',
     'admin/check'
];

But adding admin/test/{testId} route in except is not working.

What am I doing wrong?

Note - Using Laravel 5.3



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire