[英]Why i can not register and login in Laravel 5.2?
我遇到了Laravel 5.2登錄和注冊的問題。我在這里使用Laravel 5.2默認login.blade.php
和register.blade.php
。所有事情都順利但當我試圖注冊任何用戶並填寫表格並提交然后它不會在數據庫中插入任何數據,並且在瀏覽器窗口中顯示相同的頁面。雖然我已經使調試true
但瀏覽器沒有顯示任何錯誤。
這是我的routes.php:
<?php
use App\Member;
use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
| Routes File
|--------------------------------------------------------------------------
|
| Here is where you will register all of the routes in 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');
});
Route::get('/home', function () {
return view('home');
});
Route::get('/members', 'MemberController@index');
Route::post('/member', 'MemberController@store');
Route::delete('/member/{member}', 'MemberController@destroy');
// Authentication Routes...
Route::get('auth/login', 'Auth\AuthController@getLogin');
Route::post('auth/login', 'Auth\AuthController@postLogin');
Route::get('auth/logout', 'Auth\AuthController@logout');
// Registration Routes...
Route::get('auth/register', 'Auth\AuthController@getRegister');
Route::post('auth/register', 'Auth\AuthController@postRegister');
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/
Route::group(['middleware' => ['web']], function () {
//
});
Route::group(['middleware' => 'web'], function () {
Route::auth();
Route::get('/home', 'HomeController@index');
});
我在Stackoverflow中已經閱讀了很多問題。但是所有問題都無法解決我的問題。這里是這些問題的一些鏈接:
如果你需要任何文件找到解決方案,請告訴我。然后我會在這里提供。
你已經閱讀了答案,你只是沒有正確應用它。 Auth需要會話。 任何需要會話信息的路由都應該在web
中間件組中。
現在,您的member
, members
, auth/login
, auth/logout
, auth/register
,“主頁”和/
路由都在web
中間件組之外,因此它們都不會提供會話信息(這意味着它們都不可用)將顯示用戶登錄)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.