My delete function | method can not delete in Laravel Vuejs

This is why i can’t delete by ID, even the code is inactive at id, … Read more My delete function | method can not delete in Laravel Vuejs

This is why i can’t delete by ID, even the code is inactive at id, its a JS file.
This is why i can't delete by ID, even the code is inactive at id

This is my delete function in controller

> public function destroy(Estate $estates)
>     {
>         if ($estates->delete()) {
>             return response()->json([
>                 'message' => 'Estate deleted successfully',
>                 'status_code' => 200
>             ], 200);
>         } else {
>             return response()->json([
>                 'message' => 'Can not delete, Some error occured, please try again later',
>                 'status_code' => 500
>             ], 500);
>         }
>     }

Below is my Vue method to initiate the delete method
first is my button
second is my delete method

<button class="btn btn-danger btn-sm" v-on:click="deleteEstate(estate)"> <span class="fas fa-trash-alt"></span></button>
   
>        deleteEstate: async function(estate) {
>         if (!window.confirm('Are You sure you want to delete this Estate Record!')) {
>            return;
>         }
> 
>         try {
>             await estateService.deleteEstate(estate.id);
> 
>             this.estate = this.estate.filter(obj => {
>               return obj.id != estate.id;
>             });
>         } catch (error) {
>           
>         }
>       }

this is my result on delete, need some help!
this is my result on delete, need some help

Source: Vue – Stack Overflow


Categories: NewsTags: , , ,

Tags: , , ,


Leave a Reply

Your email address will not be published. Required fields are marked *

My delete function | method can not delete in Laravel Vuejs

This is why i can’t delete by ID, even the code is inactive at id, … Read more My delete function | method can not delete in Laravel Vuejs

This is why i can’t delete by ID, even the code is inactive at id, its a JS file.
This is why i can't delete by ID, even the code is inactive at id

This is my delete function in controller

> public function destroy(Estate $estates)
>     {
>         if ($estates->delete()) {
>             return response()->json([
>                 'message' => 'Estate deleted successfully',
>                 'status_code' => 200
>             ], 200);
>         } else {
>             return response()->json([
>                 'message' => 'Can not delete, Some error occured, please try again later',
>                 'status_code' => 500
>             ], 500);
>         }
>     }

Below is my Vue method to initiate the delete method
first is my button
second is my delete method

<button class="btn btn-danger btn-sm" v-on:click="deleteEstate(estate)"> <span class="fas fa-trash-alt"></span></button>
   
>        deleteEstate: async function(estate) {
>         if (!window.confirm('Are You sure you want to delete this Estate Record!')) {
>            return;
>         }
> 
>         try {
>             await estateService.deleteEstate(estate.id);
> 
>             this.estate = this.estate.filter(obj => {
>               return obj.id != estate.id;
>             });
>         } catch (error) {
>           
>         }
>       }

this is my result on delete, need some help!
this is my result on delete, need some help

Source: Vue – Stack Overflow


Categories: NewsTags: , , ,

Tags: , , ,


Leave a Reply

Your email address will not be published. Required fields are marked *