mardi 2 octobre 2018

when submit the from it goes to the wrong route using laravel 5.6

when i have tried to submit the login form it goes to the logout route whit MethodNotAllowedHttpException error and no message

// this is my route
Route::get('/',function(){return view('users.home');});
Route::get('register', 'RegisterController@showRegistrationForm')->name('showRegister');
Route::post('register', 'RegisterController@register')->name('Register');
Route::get('login', 'LoginController@showLoginForm')->name('showLogin');
Route::post('login', 'LoginController@login')->name('login');

and this is my login and logout controller

 public function login(loginRequest $request )
{

    if ( Auth()->attempt(['email' => $request->Username, 'password' => $request->Password], $request->remember) ) {
        return redirect()->intended( url('dashboard') );
    }// Authentication failed, redirect back to the login form
    return redirect($this->redirect);
}

/**
 * Log the user out of the application.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return \Illuminate\Http\Response
 */
public function logout(Request $request)
{
    Auth::guard()->logout();
    $request->session()->flush();
    return redirect()->guest(route('showLogin'));
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire