Tuesday, May 23, 2017

DELETE route using vue-resource and laravel throwing 500 error

I have a route that will be used to delete an item.

Route::delete('items/{item}', 'ItemsController@destroy')->name('admin.items.destroy');

I have a vue component that, when a button is clicked, runs this method to delete the item.

removeItem() {

    let itemCode = this.item.itemCode;

    this.itemCode = this.item = null;

    this.$http.delete('/items/' + itemCode)
      .then(function(response) {
        this.refreshPage()
      });
  }, 

The result is a 500 internal server error when the request is made.

I have not had much success in finding out why.



via DanielPahor

Advertisement