douxuan0698 2016-06-27 05:35
浏览 47
已采纳

路线未定义laravel 5.2错误

I am building a login page for the user in which one can sign up by filling the sign up form or can login with facebook.

Login with facebook is working fine and is routing to the user's profile page whereas when one logins after registering on the site ,error occurs stating that "route[myplace] not defined which is working in case of login with facebook.

My routes.php file:

Route::get('/', function () {
return view('welcome');
 })->name('home');


Route::post('/signup' , [

                'uses' => 'UserController@postSignUp' ,
                'as' => 'signup' 
    ]);

Route::post('/signin' , [

                'uses' => 'UserController@postSignIn' ,
                'as' => 'signin' 
    ]);


Route::get('/myplace' , [

        'uses' => 'UserController@getmyplace' ,

        'as' => 'myplace' ,

        'middleware' => 'auth:web'

])->name('myplace');

Route::get('/verify' , [ 


                'uses' => 'UserController@getverify' ,
                'as' => 'verify' 


    ]);

 Route::get('login', 'Auth\AuthController@redirectToFacebook');
 Route::get('login/callback', 'Auth\AuthController@getFacebookCallback');

my postSignIn function in UserController.php:

public function postSignIn(Request $request)
{

    $this->validate($request,[

            'email'=> 'required' ,
            'password' => 'required'

            ]);


    if(Auth::attempt(['email'=>$request['email'], 'password' => $request['password']]))
    {
        return redirect()->route('myplace');
    }

        return redirect()->back();
}

展开全部

  • 写回答

1条回答 默认 最新

  • duanjuebin2519 2016-06-27 07:06
    关注

    Actually,I was using same route for different controllers.So ,i just copied my myplace function from UserController.php to AuthController.php and it worked.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?