2017-05-31 95 views
0

AT login.blade.phpMethodNotAllowedHttpException在RouteCollection.php行251:

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset="utf-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
    <meta name="description" content="Creative - Bootstrap 3 Responsive Admin Template"> 
    <meta name="author" content="GeeksLabs"> 
    <meta name="keyword" content="Creative, Dashboard, Admin, Template, Theme, Bootstrap, Responsive, Retina, Minimal"> 
    <link rel="shortcut icon" href="img/favicon.png"> 

    <title>welcome</title> 
    <link href="css/bootstrap.min.css" rel="stylesheet"> 
    <link href="css/bootstrap-theme.css" rel="stylesheet"> 
    <link href="css/elegant-icons-style.css" rel="stylesheet" /> 
    <link href="css/font-awesome.css" rel="stylesheet" /> 
    <link href="css/style.css" rel="stylesheet"> 
    <link href="css/style-responsive.css" rel="stylesheet" /> 

</head> 
    <body class="login-img3-body"> 
    <div class="container"> 
     <form class="login-form" method="post" action="{{ url('/dashboard') }}"> //{{ route('login') }} 
     <input type="hidden" name="_token" value="{{ csrf_field() }} "> 

     <div class="login-wrap"> 
      <p class="login-img"><i class="icon_lock_alt"></i></p> 
      <div class="input-group"> 
       <span class="input-group-addon"><i class="icon_profile"></i></span> 
       <input type="text" name="Username" class="form-control" placeholder="Username" autofocus> 
      </div> 
      <div class="input-group"> 
       <span class="input-group-addon"><i class="icon_key_alt"></i></span> 
       <input type="password" name="password" class="form-control" placeholder="Password"> 
      </div> 
      <label class="checkbox"> 
       <input type="checkbox" value="remember-me"> Remember me 
       <span class="pull-right"> <a href="#"> Forgot Password?</a></span> 
      </label> 
      <button class="btn btn-primary btn-lg btn-block" type="submit">Login</button> 
      <button class="btn btn-info btn-lg btn-block" type="submit">Signup</button> 
     </div> 
     </form> 
    <div class="text-right"> 
      <div class="credits"> 

       <a href="https://facebook.com/t.prakash.pokhrel/"> Developer::xxx</a> 
      </div> 
     </div> 
    </div> 
    </body> 
</html> 

而web.php

Route::get('/' , ['as' => '/' , 'uses'=> '[email protected]']); 
    Route::post('/login', ['as' => 'login', 'uses'=> '[email protected]']); 


    Route::group(['middleware' =>['authen']], function() 
    { 
    Route::get('/dashboard',['as'=>'dashboard', 'uses'=> '[email protected]']); 
    Route::get('/logout' ,['as'=>'logout', 'uses'=> '[email protected]']); 

}); 

我是在laravel更新。我有這個錯誤發生。如何解決和 method =「post」action =「{{url('/ dashboard')}}」> // {{route('login')}} 「{{csrf_field()}}行動領域哪個URL應該傳遞..我的意思是目的地或相同的路徑..我想重定向到儀表板..謝謝:)

回答

0

檢查什麼UR途徑是通過使用

PHP工匠期待路線:列表命令在終端 下一個更改您的表單方法

如果你想用戶重定向到儀表板你需要做到這一點烏爾controller`

`class ProfileController extends Controller 
{ 
    //your code here 

public dashbord(){ 

// your code 

    return view("your dashboard view path");  
    } 
2

嘗試改變路線

首先,您需要設置登錄路由URL形式(行動= 「{{URL( '/登錄')}}」),並提交後,在postlogin函數中使用auth並檢查郵件密碼是否正確。如果重定向url是儀表板。

相關問題