Saturday, 15 March 2014

php - Laravel forms - route not defined -



php - Laravel forms - route not defined -

i using laravel create simple form:

{{ form::open(array('route' => 'postrequest')) }} {{ form::text('name') }} {{ form::text('surname') }} {{ form::submit('submit') }} {{ form::close() }}

in routes.php file defined route:

route::post('postrequest', function() { homecoming view::make('home'); });

but i'm getting error in log file:

next exception 'errorexception' message 'route [postrequest] not defined.

i couldnt find solution on internet. i'm doing wrong?

you seek utilize here named route. if want need alter route into:

route::post('postrequest', array('as' => 'postrequest', function() { homecoming view::make('home'); }));

or can of course of study alter way open form using direct url:

{{ form::open(array('url' => 'postrequest')) }}

but should consider using named routes.

php forms exception laravel routes

No comments:

Post a Comment