2016-07-01 4 views
0

。私はこの問題を引き起こしていることは確かではありません。イムわからない私のroutes.phpファイルここlaravel私は<code>auth/login</code>パスにリダイレクト<code>mywebsite.com/home</code>に行くが、それは、このエラーメッセージをロードするたびにlaravel 5.1</p> <p>での作業5.1ルート・エラー・メッセージ

<?php 

/* 
|-------------------------------------------------------------------------- 
| Application Routes 
|-------------------------------------------------------------------------- 
| 
| Here is where you can register all of the routes for an application. 
| It's a breeze. Simply tell Laravel the URIs it should respond to 
| and give it the controller to call when that URI is requested. 
| 
*/ 

Route::get('/', function() { 
    return view('welcome'); 
}); 

// Authentication routes 
Route::get('login', 'Auth\[email protected]'); 
Route::post('auth/login', 'Auth\[email protected]'); 
Route::get('auth/logout', 'Auth\[email protected]'); 

// Registration routes 
Route::get('register', 'Auth\[email protected]'); 
Route::post('auth/register', 'Auth\[email protected]'); 
Route::controllers(['password' => 'Auth\PasswordController',]); 

Route::get('/home', '[email protected]'); 

// Using A Route Closure 
Route::get('profile', ['middleware' => 'auth', function() { 
    // Only authenticated users may enter... 
    Route::auth(); 
}]); 

<?php 

namespace App\Http\Controllers; 

use Auth; 
use App\Http\Requests; 
use Illuminate\Http\Request; 

class HomeController extends Controller 
{ 
    /** 
    * Create a new controller instance. 
    * 
    * @return void 
    */ 
    public function __construct() 
    { 
     $this->middleware('auth'); 
    } 

    /** 
    * Show the application dashboard. 
    * 
    * @return \Illuminate\Http\Response 
    */ 

    public function index() 
    { 
     if(Auth::check()) { 
      return view('home'); 
     } 

     return view('auth/login'); 
    } 
} 

マイHomeController.phpインデックス機能はかなりstriaght前方にある私のHomeController.phpファイルが何であるかをここで

MethodNotAllowedHttpException in RouteCollection.php line 219:

を見下ろすイムです。すべてのヘルプ

答えて

0

する必要がありますあなたはあなたのルートファイルでミスを犯しました。あなたのルートファイルがうまくいけば、これはあなたがここにhttps://laravel.com/docs/5.2/authentication#authentication-quickstart

を見てみる必要があり、あなたの仕事を容易にするためにLaravelの認証モジュールを使用している場合あなたがなりあなたの問題

0

を解決する

<?php 

/* 
|-------------------------------------------------------------------------- 
| Application Routes 
|-------------------------------------------------------------------------- 
| 
| Here is where you can register all of the routes for an application. 
| It's a breeze. Simply tell Laravel the URIs it should respond to 
| and give it the controller to call when that URI is requested. 
| 
*/ 

Route::get('/', function() { 
    return view('welcome'); 
}); 

// Authentication routes 
Route::get('auth/login', 'Auth\[email protected]'); 
Route::post('auth/login', 'Auth\[email protected]'); 
Route::get('auth/logout', 'Auth\[email protected]'); 

// Registration routes 
Route::get('auth/register', 'Auth\[email protected]'); 
Route::post('auth/register', 'Auth\[email protected]'); 
Route::controllers(['password' => 'Auth\PasswordController',]); 

Route::get('/home', '[email protected]'); 

// Using A Route Closure 
Route::get('profile', ['middleware' => 'auth', function() { 
    // Only authenticated users may enter... 
    Route::auth(); 
}]); 

する必要があります独自のリダイレクトとパスを定義することができます。あなたはまた、Http/Middlewaresフォルダの下に、あなたのAuthenticate.phpミドルウェアをチェック

  • する場合があります

    、あなたはゲストを見つけるあなたは'auth'ミドルウェアを設定しているあなたのHomeController.phpコンストラクタ、それ故に誰の視察で

  • がリダイレクト/home、ログに記録されていませんが、私はヨーヨーをお勧めします私自身の経験から、今Authenticate.phpミドルウェア

に設定されたURLにリダイレクトされますLaravelの認証ヘルパーを使用してより速く移動することができます。ホイールを再構築するのではなく、使い勝手のよいものです。

独自の認証プロセスを構築することは、コードやテストで手を汚したくない場合には、退屈な作業になる可能性があります。

関連する問題

 関連する問題