Laravel Search Delete

Posted 4 months 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);
  $sub->delete();
  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.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.