1 year ago

Laravel Search Delete

Posted 1 year ago by evripidesk

When I make search and I get the search results, I try to delete a record , its deleted show the message that successfully deleted but after I get the error throw new MethodNotAllowedHttpException($others);

​``` public function destroy($id) { $id=Hashids::decode($id); $id = implode(',', $id);

  $sub = Subs::find($id);
  return response()->json(['success'=>"Subscription Plan Deleted 
  successfully.", 'tr'=>'tr_'.$id]);

} ​```

Call Function

`` a href="{{action('[email protected]', Hashids::encode($sub['id']))}}" class="btn btn-danger btn" data-tr="tr_{{$sub['id']}}" data-toggle="confirmation" data-btn-ok-label="Delete" data-btn-ok-icon="fa fa-remove" data-btn-ok-class="btn btn btn-danger" data-btn-cancel-label="Cancel" data-btn-cancel-icon="fa fa-chevron-circle-left" data-btn-cancel-class="btn btn btn-default" data-title="Are you sure you want to delete ?" data-placement="left" data-singleton="true"> Delete </a>

Routes ​```

Route::post('/subscriptions/search/results','[email protected]'); Route::get('/subscriptions/restore/{id}', '[email protected]');​

Please sign in or create an account to participate in this conversation.