change from put to post / patch, I'm pretty sure safari has restrictions with put.
// Route
Route::patch(...);
// Call
axios.patch(...)
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
i'm struggling with this issue since a couple of hours now, on my app i'm requesting data from DB using axios ajax function.
this is the js function on my store.js store file
async saveText({commit}, [id, text, name, wIndex]){
await axios.put('/admin/designer/api/widget/text', {
elem: text,
elemName : name,
elemId: id,
})
.then(function (response) {
commit('UPDATE_W_ELEM', [name, wIndex, response.data]);
})
.catch(function (error) {
Event.$emit('requestAlertDanger');
});
},
this is the route
Route::put('/widget/text', 'PageController@updatewidgettext');
this is what i have on the controller
public function updatewidgettext(Request $request)
{
$request->validate([
'elem' => 'required|string',
'elemName' => 'required|string',
'elemId' => 'required|integer'
]);
$name = $request['elemName'];
$elemId = $request['elemId'];
$elemText = trim($request['elem']);
$updateWidget = Widget::findOrFail($elemId);
$updateWidget->$name = Purifier::clean($request['elem'], 'designer');
$updateWidget->save();
Cache::forget('page-'.$updateWidget->page_id); // front page cached file
return $updateWidget->$name;
}
the function is working perfectly on chrome and firefox but not on safari, I'm not sure why by i getting this error
{
"message": "The given data was invalid.",
"errors": {
"elem": [
" field elem required."
],
"elemName": [
" field elem name required."
],
"elemId": [
" field elem id required."
]
}
}
it looks like axios is not being able to pass the data on safari properly, ????
is there is anything i can do to solve this issue????
Any idea ????
Please or to participate in this conversation.