Reputation: 95
I keep getting the error "Missing argument 1 for App\Http\Controllers\Users::deleteMobileAssets()" . I am making a call from my frontend with Vue. When I check the headers, it seems correct but I'm not sure what is causing the error. I've tried wrapping imageType in brackets too: {imageType: imageType}
but still same error.
deleteImage(imageType) {
axios.post('/delete-mobile-assets', imageType);
}
public function deleteMobileAssets($imageType)
{
}
Upvotes: 0
Views: 51
Reputation: 1801
POST data is included in the body of the request that way you are getting Missing argument 1. Try this
deleteImage(imageType) {
axios.post('/delete-mobile-assets', {imageType:imageType});
}
public function deleteMobileAssets(Request $request)
{
$request->imageType
}
Or if you want to implement DELETE method. have a look Delete Method in Axios, Laravel and VueJS
Upvotes: 1