1//route
2Route::delete('/dashboard/booking/deletebooking/{id}','ResourceController@deletebooking')->name('works.deletebooking');
3
4//resource controller
5public function deletebooking($id){
6 $booking = Booking::where('id','=',$id)->get();
7 $booking->delete();
8
9 return response()->json(['success' => true],200);
10}
11
12//javascript
13$.ajax(
14 {
15 url: "/dashboard/booking/deletebooking/"+id,
16 dataType: "JSON",
17 type: 'DELETE',
18 data: {
19 '_token': $('meta[name=csrf-token]').attr("content"),
20 },
21 success: function ()
22 {
23 console.log("it Work");
24 }
25 });