I have a problem with Laravel 4 nested routing. I can display the form of the creation method, but I cannot save. Here is the code, I’ll just get to the point. I have a basic resource controller and another nested controller
This is in my Routes.php
Route::resource('profile','ProfileController');
Route::resource('profile.bands','BandsController');
I don’t think I need to display the profile code here, I will show you the BandsController
public function create($profileId)
{
return View::make('bands.create',['title' => 'Create Band Profile' , 'profileId' => $profileId]);
}
This will simply display the form, as you know. The form:
{{Form::open( [ 'route' => ['profile.bands.create',$profileId]])}}
<input class="input" type="text" name="name" value="" />
<input class="input" type="text" name="city" value="" />
<input type="submit" value="submit" />
{{Form::close()}}
Now I do not understand that the form URL looks good when I view it in a browser, but when I submit it, I get this error.
Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException
open: E:\server\www\gigmor.com\gigmor\vendor\laravel\framework\src\Illuminate\Routing\Router.php
elseif ($e instanceof MethodNotAllowedException)
{
$allowed = $e->getAllowedMethods();
throw new MethodNotAllowedHttpException($allowed, $e->getMessage());
}
}
What could I do wrong?
source
share