與laravel 5.1laravel 5.1路線錯誤信息
工作每當我去mywebsite.com/home
我重定向到auth/login
路徑,但它加載此錯誤消息。林不知道是什麼原因造成這個問題,一切都仍然是開箱即用。林不知道什麼即時通訊俯瞰
MethodNotAllowedHttpException in RouteCollection.php line 219:
這裏是我的routes.php
文件
<?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();
}]);
這裏是我的HomeController.php
文件
<?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前進。感謝所有幫助