简体   繁体   English

RouteCollection.php 219行中的MethodNotAllowedHttpException错误laravel:

[英]MethodNotAllowedHttpException in RouteCollection.php line 219 error laravel:

I get this error when i try to access the post signin route. 当我尝试访问发布登录路由时收到此错误。 I'm new to laravel and i can't seem to figure out how to solve this error. 我是laravel的新手,我似乎无法弄清楚如何解决此错误。 Please help. 请帮忙。

My Routes.php 我的Routes.php

 Route::group(['middleware' => ['web']], function () {
 Route::get('/', [
'uses'=>'\ocsaf\Http\Controllers\HomeController@index',
'as'=>'home',
 ]);



/*
  *Authentication
 */

Route::get('/signup', [
 'uses'=>'\ocsaf\Http\Controllers\AuthController@getSignUp',
 'as'=>'auth.signup',
 'middleware' => ['guest'],
 ]);

 Route::post('/signup', [
 'uses'=>'\ocsaf\Http\Controllers\AuthController@postSignUp',
 'middleware' => ['guest'],
 ]);

 Route::get('/signin', [
 'uses'=>'\ocsaf\Http\Controllers\AuthController@getSignIn',
 'as'=>'auth.signin',
 'middleware' => ['guest'],
 ]);

 Route::post('/signup', [
 'uses'=>'\ocsaf\Http\Controllers\AuthController@postSignIn',
 'middleware' => ['guest'],
 ]);

  Route::get('/signout', [
 'uses'=>'\ocsaf\Http\Controllers\AuthController@getSignOut',
 'as'=>'auth.signout',
  ]);


 /*
 *search
 */

  Route::get('/search', [
  'uses'=>'\ocsaf\Http\Controllers\SearchController@getResults',
  'as'=>'search.results',
  ]);



  /*
  *Profile
  */

   Route::get('/user/{username}', [
   'uses'=>'\ocsaf\Http\Controllers\ProfileController@getProfile',
   'as'=>'profile.index',
   ]);

   Route::get('/profile/edit', [
   'uses'=>'\ocsaf\Http\Controllers\ProfileController@getEdit',
   'as'=>'profile.edit',
   'middleware'=>['auth'],
   ]);

   Route::post('/profile/edit', [
   'uses'=>'\ocsaf\Http\Controllers\ProfileController@postEdit',
   'as'=>'profile.edit',
   'middleware'=>['auth'],
   ]);

   Route::post('/profile/edit', [
   'uses'=>'\ocsaf\Http\Controllers\StatusController@postStatus',
   'as'=>'status.post',
   'middleware'=>['auth'],
   ]);

   });

AuthController.php AuthController.php

    namespace ocsaf\Http\Controllers;
    use Auth;
   use Illuminate\Http\Request;
   use ocsaf\Models\User;



  class AuthController extends Controller
  {

  public function getSignUp()
  {
  return view('auth.signup');
  }

public function postSignUp(Request $request)
{
$this->validate($request, [
'email' => 'required|unique:users|email|max:255',
'username' => 'required|unique:users|alpha_dash|max:255',
'password' => 'required|min:6',


 ]);
 User::create([
    'email' => $request-> input('email'),
    'username' => $request-> input('username'),
    'password' => bcrypt($request -> input('password')),
 ]);

  return redirect()
  ->route('home')
  ->with('info', 'You have signed up, Please sign in!');
   }

  public function getSignIn()
  {
  return view('auth.signin');
  }

  public function postSignIn(Request $request)
  {
  $this->validate($request, [
  'email' => 'required',
  'password' => 'required',

  ]);

  if(!Auth::attempt($request -> only(['email', 'password' ]), 
  $request ->         has('remember'))){
    return redirect() ->back()->
 with('info', 'could not sign you in with those   details   ');
 }

 return redirect() ->route('home')->with('info', 'You are now signed in');

 }

 }

my signin.blade.php form statement 我的signin.blade.php表单声明

    <form class="form-vertical" role = "form" 
    method = "post" action = "{{     route('auth.signin'); }}">

您的form方法是post但是对于路由auth.signin ,HTTP动词是get

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 RouteCollection.php 第 219 行中的 Laravel 5 MethodNotAllowedHttpException - Laravel 5 MethodNotAllowedHttpException in RouteCollection.php line 219 Laravel 5:RouteCollection.php第219行中的MethodNotAllowedHttpException - Laravel 5: MethodNotAllowedHttpException in RouteCollection.php line 219 Laravel 5在RouteCollection.php第219行中的MethodNotAllowedHttpException: - Laravel 5 MethodNotAllowedHttpException in RouteCollection.php line 219: Laravel 错误:RouteCollection.php 第 219 行中的 MethodNotAllowedHttpException - Laravel error: MethodNotAllowedHttpException in RouteCollection.php line 219 Laravel API 中 RouteCollection.php 第 219 行中的 MethodNotAllowedHttpException - MethodNotAllowedHttpException in RouteCollection.php line 219 in laravel API's Laravel 5.2:RouteCollection.php 第 219 行中的 MethodNotAllowedHttpException - Laravel 5.2 : MethodNotAllowedHttpException in RouteCollection.php line 219 在Laravel中在RouteCollection.php第219行中获取MethodNotAllowedHttpException - Getting MethodNotAllowedHttpException in RouteCollection.php line 219: on laravel 在RouteCollection.php第219行中的Laravel 5.2 MethodNotAllowedHttpException - Laravel 5.2 MethodNotAllowedHttpException in RouteCollection.php line 219 Laravel 5.1.26:RouteCollection.php第219行中的MethodNotAllowedHttpException - Laravel 5.1.26 : MethodNotAllowedHttpException in RouteCollection.php line 219 RouteCollection.php第219行中的MethodNotAllowedHttpException - MethodNotAllowedHttpException in RouteCollection.php line 219
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM