[Vuejs]-Laravel Delete not Working with API Route

0đź‘Ť

âś…

Solution: I din’t really find a solution to the problem so I worked around it. Using

Servicetype::destroy($id);

did nothing. But, using:

DB::table('servicetypes')->where('id', $id)->delete();

did work. I was hoping to use softdeletes but found some other issues with that and using query builder so in the end I did a little re-coding to make the problem “go away.” I may dig into it some more when I have time. It was strange behavior. I updated the description accordingly.

👤ScottM

0đź‘Ť

try this:

axios.post('/api/servicetypelinking/' + id +  '/ignore', {_method: 'delete'})
👤Artur Smolen

0đź‘Ť

In Controller:

Servicetype::find($id)->delete();

If it doesn’t work, so need to check existing record with $id.

Log:info( Servicetype::find($id) );

If it’s empty – then problem with wrong id of record.

Leave a comment