@mvpop What exactly does you Livewire component look like? Especially the delete button, did you use a <a> tag there or wrapped it inside a form that is submitted?
Livewire Pagination Error - The GET method is not supported for this route.
So I have the following route:
Route::get('produse/', 'ProduseController@index')->name('arataProduse');
And I return a blade view return view('produse.index'); from ProduseController@index
Now in my blade view I load a Livewire component <livewire:component-name />
The component is basically a datatable with some crud functionality taken care by Livewire.
THE PROBLEM
Once I delete a record from my table and I try to go to any page of the table, I get a 404 Not found error. This happens only after performing the delete() on the model. It doesn't happen after the create or edit methods being called, just on delete.
This is the code for the delete method:
$produse = Produse::whereKey($this->selectate);
$produse->delete();
$this->arataModalStergere = false;
What can get wrong ?
After the not found error is produced, I have another error in the console saying Failed to load resource: the server responded with a status of 404 (Not Found) and if I click on the link in the console this is what I get The GET method is not supported for this route. Supported methods: POST.
If I hit refresh everything works just fine.
Any idea why I get this behavior?
Thanks.
I was able to trigger the issue by calling the pagination links like below
{{ $data->links() }}
I fixed that by adding withQueryString(), hope this help
{{ $data->withQueryString()->links() }}
Edit: The URL that brought this error
http://127.0.0.1:8000/livewire/message/users?page=7
Please or to participate in this conversation.