binshops / laravel-blog

Laravel Blog Package/ Laravel CMS. Easiest way to add a blogging system to your Laravel website. Laravel Blog.
https://www.binshops.com
MIT License
429 stars 134 forks source link

Url Length Exceeded #62

Closed usman-xs4arabia-dev closed 2 years ago

usman-xs4arabia-dev commented 2 years ago

You guys are using patch method while editing post. When you change the language the whole content of the post is coming with the url which can be problematic for server because we can not specify the length of the url. If the content of the blog will increase it will cause Url too long, length exceeded error. I would recommend instead of get use post method. Because I'm facing this issue on our live server. Thanks

usman-xs4arabia-dev commented 2 years ago

In routes.php you should update your urls From Route::get('/edit_post_toggle/{blogPostId}', 'BinshopsAdminController@edit_post_toggle') ->name('binshopsblog.admin.edit_post_toggle');

Route::patch('/edit_post/{blogPostId}', 'BinshopsAdminController@update_post') ->name('binshopsblog.admin.update_post');

To Route::post('/edit_post_toggle/{blogPostId}', 'BinshopsAdminController@edit_post_toggle') ->name('binshopsblog.admin.edit_post_toggle');

Route::post('/edit_post/{blogPostId}', 'BinshopsAdminController@update_post') ->name('binshopsblog.admin.update_post');

And then in edit_post.blade.php remove @method("patch") And update this jquery line $("#edit-post-form").attr("method", "get"); to $("#edit-post-form").attr("method", "post");

Just these two updates nothing else all the things will work normally no need for major changes.

Hopefully you will understand the problem and resolve it asap.

samberrry commented 2 years ago

@usman-xs4arabia-dev thanks for reporting. We will have an update soon.

samberrry commented 2 years ago

thanks for your contribution. PR merged: https://github.com/binshops/laravel-blog/pull/65