Support the ongoing development of Laravel.io →
posted 10 years ago
Input Forms

Hello, I'm creating a custom package that involves a CRUD resource. Because it involves extra steps, I DO NOT users to have to install the Form:: and Html:: facades and helpers.

So, I'm trying to create a standard form, but running into an error when I'm trying to do a "edit" form. For the opening form, I'm using this\

Normally, I would just use the Form Facade to bind the form. For example:

{{ Form::model($umduser, array('route' => array('umdusers.update', $umduser->id), 'method' => 'PUT')) }}

I've tried the following w/ variations, but no luck.

<form action="/umdusers/update" method="PUT">

Anyone know of the form action to use to edit/update a CRUD Resource?

Thanks! Troy

Last updated 3 years ago.
0

It needs an ID of the resource you're editing in the action param. I would recommend you doing a php artisan route:list it always helps me when I forget the syntax.

EDIT:

Relevant doc page: http://laravel.com/docs/5.1/controllers#restful-resource-controllers

Last updated 10 years ago.
0

@tepeters in HTML there's no actual method called PUT or PATCH - there's only GET and POST. So when you call Form::open with Laravel, it actually changes it to POST with hidden field. Something like this:

<form method="POST" action="xxxxxx/clients/20" accept-charset="UTF-8">  
<input name="_method" type="hidden" value="PATCH">
0

I was able to find the solution using a named route as the action instead of an actual path. In addition, using the "POST" method similar to @PovilasKorop (thanks!)

Here's the solution for the opening tag:

<form action="{{ route('umdusers.update', $umduser->id) }}" method="POST">
    <input type="hidden" name="_method" value="PUT">
0

Sign in to participate in this thread!

Eventy

Your banner here too?

tepeters tepeters Joined 25 Jun 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.