Support the ongoing development of Laravel.io →
Requests Database Forms
Last updated 9 months ago.
0

Hello,

Your route has post method. Are you sure you are sending request with post method?

Last updated 9 months ago.
0

I am also getting the same error.

View:

@extends('layouts.main')

@section('content')

	<h1>Create new account</h1>

    {{ Form::open(['route' => 'account-create-post']) }}

            ...
	    <div>
	        {{ Form::label('password_confirm', 'Confirm password:') }}
	        {{ Form::password('password_confirm') }}
	       @if($errors->has('password_confirm')){{$errors->first('password_confirm')}}@endif
	    </div>

	    <div>{{ Form::submit('Create account') }}</div>

    {{ Form::close() }}
@stop

AccountsController:

<?php

class AccountController extends BaseController {
	public function getCreate(){
		return View::make('account.create');
	}

	public function postCreate(){
		return 'Hello.';
	}
}

routes file:

/*
/Unauthenticated group
*/
Route::group(array('before' => 'guest'), function(){

	/*
	/ CSRF group
	*/
	Route::group(array('before' => 'csrf'), function(){

		/*
		/ Create account (POST)
		*/
		Route::get('/account/create', array(
			'as' => 'account-create-post',
			'uses' => '[email protected]'
		));

	});

	/*
	/ Create account (GET)
	*/
	Route::get('/account/create', array(
		'as' => 'account-create',
		'uses' => '[email protected]'
	));

});

I think the problem is the POST but I don't know how to solve it.

Last updated 9 months ago.
0

Everything is explained here: http://laravel.com/docs/4.2/routing

If you want the route to be executed on POST method, you need to use Route::post() instead of Route::get(). But there's more, you can just make controllers' methods reflect URL directly, without adding routes. That's what Route::controller() is for.

Just read it.

Last updated 9 months ago.
0

and how do i prevent a MethodNotAllowedHttpException in RouteCollection.php when someone access a post-route without giving post parameters?

0

Sign in to participate in this thread!

Full Stack Europe

Your banner here too?

acdragon acdragon Joined 15 Aug 2014

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.

© 2023 Laravel.io - All rights reserved.