can someone tell me how can I still have pretty URL when trying to edit my post? I have slugs etc but for edit method, we need to use GET|HEAD which means we will have something like this:
Instead of this:
www.our-domen.com/admin/posts/this-is-my-post-for-edit/edit
Here is the part of the code:
<td>
<form action="{{ route('posts.edit', $post->slug) }}" method="get">
@csrf
<button type="submit" name="btn-editPost" class="btn btn-info btn-sm" style="color: white;">Edit</button>
</form>
</td>
Note : slugs are set up correctly, it is not a problem :)
You don't need the form actually, if you just delete @csrf
, it will work.
Or, change your code :
<td>
<form action="{{ route('posts.edit', $post->slug) }}" method="get">
@csrf
<button type="submit" name="btn-editPost" class="btn btn-info btn-sm" style="color: white;">Edit</button>
</form>
<td>
To,
<td>
<a href="{{ route('posts.edit', $post->slug) }}" type="button" class="btn btn-info btn-sm" style="color: white;">Edit</a>
</td>