MethodNotAllowedHttpException laravel-4
exception, forms, laravel, laravel-4, php
Solution
I'd just like to add my own discovery along these lines... Maybe this will save someone else the head-scratching I just performed.
I too implemented the Route::resource mechanism. I couldn't figure out why my create was working but my update was not. It turns out you can't reuse the same form code exactly, the form that does an update must use the method PUT or PATCH. Why update couldn't be a POST is beyond me.
That is to say, the opening form tag for an update must look like this:
Form::model($thing, array(
'method' => 'PUT',
'route' => array('things.update', $thing->id)
)
Without specifying method => PUT, you get this not-helpful error.
Problem
Form : ``` {{ Form::open(array('url' => 'user/create', 'files' => true)) }} ``` Route : ``` Route::resource('user', 'UserController'); ``` UserController.php ``` class UserController extends BaseController { public function index() { return 'hi11'; //return View::make('home.index'); } public function create() { return 'hi22'; //return View::make('home.index'); } } ``` This code gives `Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException`