1

I want to call my functions from android side.

now, I want to send post values from android side.

How can I disable csrf token for some functions ?

because without it I got error message .

like this:

Route::post('mobile/android/getlastnews','NewsController@getLastNews');
2

2 Answers 2

6

Open app/Http/Middleware/VerifyCsrfToken.php and in the protected $except = []; array add your URL that you want to be skipped for CSRF validation.

Sign up to request clarification or add additional context in comments.

Comments

6

For Laravel 5.2, inside app/Http/Middleware/VerifyCsrfToken.php you just need to add it to the $except array.

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

If you wanted to allow all routes for mobile/ you can do the following

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.