[Vuejs]-Why am getting method not allowed error when saving the data in Laravel?

2👍

In your Vue code your should use POST request to the '/holiday' instead of the '/holiday/store'.

Defining resource route is equivalent to:

Route::get('/holiday', 'HolidayController@index');
Route::get('/holiday/create', 'HolidayController@create');
Route::post('/holiday', 'HolidayController@store');
Route::get('/holiday/{holiday}', 'HolidayController@show');
Route::get('/holiday/{holiday}/edit', 'HolidayController@edit');
Route::put('/holiday/{holiday}', 'HolidayController@update');
Route::patch('/holiday/{holiday}', 'HolidayController@update');
Route::delete('/holiday/{holiday}', 'HolidayController@destroy');

https://laravel.com/docs/5.8/controllers#resource-controllers

2👍

Your url '/holiday/store' dose not much Route::resource('holiday', 'HolidayController');

Fix

await this.$inertia.post('holiday', this.holiday)

To check routes and its corresponding URIs

Run the following command

php artisan route:list

Leave a comment