Laravel по-русски

Русское сообщество разработки на PHP-фреймворке Laravel.

Ты не вошёл. Вход тут.

#1 Re: Laravel 5.x » Помогите с написание теста » 11.04.2025 12:45:59

To fix the 419 error (CSRF mismatch) in your Laravel test, ensure you are correctly sending a valid CSRF token with your POST request by using the `$this->withCsrfToken()` method within your test setup, in addition to verifying that your route is defined as a POST request and the `VerifyCsrfToken` middleware is applied; if you then encounter a 302 status after disabling CSRF (which is not recommended for production tests), investigate the logic within your controller, particularly the `Gate::denies()` check, to ensure the authenticated user has the necessary permissions and the data passed to the gate is correct.

Подвал раздела