3

I've made a laravel cms app which I'm trying to deploy on a shared hosting. Locally, it runs great.

I’ve saved all laravel app files/folders (except public) in the root under ‘adminCore’ folder. Then, I’ve copied all laravel’s public folder content to public_html/test_page folder.

When I run it (testpage.mywebpage.com), I can log in, I can 'see' all views, connect and read from the database - I can even store new data. However, if I try to edit or delete, data (from database), I get a 403 error, i.e. PUT and DELETE requests get denied.

Since I'm fairly new to this problematics, I'd really appreciate if you could explain why is this happening and/or how should this be solved. Thank you in advance!

1 Answers1

1

Laravel doesn't actually use "PUT" and "DELETE" requests in forms. Instead, a hidden form field is added to the form when you specify a PUT or DELETE action:

<input name="_method" type="hidden" value="PUT">

The issue could be that you're actually using PUT and DELTE as actions in your form, when you should be using a hidden field like above.

The form action should be POST and then then add the hidden _method field with the value of your desired action (as above). Example:

<form method="POST" action="route/url">
    <input name="_method" type="hidden" value="PUT">
    <!-- other form fields here -->
</form>
Niraj Shah
  • 15,087
  • 3
  • 41
  • 60