Someone with any tips for the subject, I researched about it and I know that we have to configure CORS but for this version of laravel it supposedly would no longer be necessary.
How can it not be necessary?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Good afternoon everyone, I'm trying to implement a notification system with the possibility to mark this notification with a like.
I am using laravel 7 for the back end and vuejs for the front end.
The code works correctly on localhost, but when I deploy to Heroku it stops working and to give me the message below.
http://springalert.herokuapp.com/api/like 405 (Method Not Allowed)
Uncaught (in promise) Error: Request failed with status code 405
at createError (app.js:5347)
at settle (app.js:5608)
at XMLHttpRequest.handleLoad (app.js:4816)
Someone with any tips for the subject, I researched about it and I know that we have to configure CORS but for this version of laravel it supposedly would no longer be necessary.
follow the code, thank you for your help.
ROUTE
Route::post('/api/like/', 'NotificationController@api_like');
CONTROLLER
public function api_like(Request $request) {
$like = new Like;
$like->notification_id = $request->id;
$like->user_id = auth()->id();
$like->save();
}
VUEJS
<b-card-text class="text-right" v-if="Object.keys(notification.like).length == 0">
<a @click="makelike('success', 'Informação', notification.id)" class="a"><i class="fas fa thumbs-up"></i></a>
</b-card-text>
makelike(variant = null, title, notification_id) {
this.id = notification_id
axios.post('api/like/',{ id:this.id })
.then((response) => {
this.set_notifications()
this.$bvToast.toast('Obrigado pela tua visualização', {
title: title,
variant: variant,
solid: true
})
})
},
Please or to participate in this conversation.