Reputation: 933
I am following the laravel 5.2 documentation on registration and am having some trouble. When I try to register I get the following error after I click the registration button.
MethodNotAllowedHttpException in RouteCollection.php line 219: in RouteCollection.php line 219
Here is the code for where I want a user to be redirected to after they register, this is in the AuthController.php.
protected $redirectTo = "pages.test";
Pages is a folder I created in the views folder. The "pages.test
" file works if I try to access it by typing in http://mywebapp.app/test into the browser.
Here is the code in my routes controller.
Route::get("test", function()
{
return view("pages.test");
});
I have tried setting $redirectTo = "test"
and "pages.test.blade.php
" and "test.blade.php
", none of these work. Any help would be appreciated.
Upvotes: 2
Views: 129
Reputation: 7985
As far i understand your question, you are trying to register users from a html form . If the method in the form is post
i.e.
<form method="post" action="your_action_url" />
then route should be
Route::post('test',function(){
return view('your_view');
});
And if method is get
then Route should be
Route::get('test',function(){
return view('your_view');
});
If you want to explore more then see the laravel doc
Upvotes: 2
Reputation: 1
Change it to this:
Route::any("test", function(){
return view("pages.test");
});
Upvotes: 1
Reputation: 7023
when you click submit button you may send post, so you can change it to:
Route::post("test", function()
{
return view("pages.test");
});
if you want any, you can use:
Route::any("test", function()
{
return view("pages.test");
});
Upvotes: 2