Русское сообщество разработки на PHP-фреймворке Laravel.
Ты не вошёл. Вход тут.
Страницы 1
Всем привет.
несколько дней не получается решить данную проблему:
у меня есть грид который выводить данные из бд, так же есть колонка с кнопками редактировать и удалить
при нажатии на кнопку редактировать уходить get запрос на получение данных:
return response()->json([
'title' => 'Редактирование записи',
'content' => view('reference.update', [
'model' => $model,
])->render(),
'footer' => implode('', [
html()
->button('Закрыть', 'button')
->class('btn btn-light')
->attributes(['data-bs-dismiss' => 'modal']),
html()
->submit('Сохранить')
->class('btn btn-info')
]),
]);
который используется для вставки в модельное окно
reference.update:
{{ html()->form('POST', $url)->open() }}
@csrf
<div class="row">
<div class="col-md-8">
{!! html()->div(
collect([
html()->label('Название')->class('form-label')->attributes(['for' => 'name']),
html()->input('text','name', $model->name)->class('form-control')
->attributes(['aria-required' => 'true', 'id' => 'name']),
html()->div('')->class('invalid-feedback')
])
)
->class('mb-3 field-name required') !!}
</div>
</div>
{{ html()->form()->close() }}
но при нажатии кнопки сохранить у меня выдает сообщение csrf token mismatch
подскажите пожалуйста как решить данную проблему?
Не в сети
To resolve the CSRF token mismatch error, ensure that the CSRF token is correctly included in your form and AJAX requests. Begin by updating the CSRF token each time the modal window is opened, embedding it within the form. Additionally, when using AJAX, make sure to set the CSRF token in the request headers by using $.ajaxSetup to automatically include the token from the meta tag. Verify that the form's action route is protected by CSRF middleware, typically enabled by default in frameworks like Laravel. If your form updates an existing record, use the "PUT" or "PATCH" HTTP methods rather than "POST", including a hidden input field specifying the method. This combination of steps should effectively address the CSRF token mismatch issue.
Не в сети
Hello,
Thanks for this post.
Не в сети
Hello,
This post was really nice.
obamacare enrollment
Не в сети
Страницы 1