繁体   English   中英

为什么我无法在Laravel 5.2中注册和登录?

[英]Why i can not register and login in Laravel 5.2?

我遇到了Laravel 5.2登录和注册的问题。我在这里使用Laravel 5.2默认login.blade.phpregister.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中间件组中。

现在,您的membermembersauth/loginauth/logoutauth/register ,“主页”和/路由都在web中间件组之外,因此它们都不会提供会话信息(这意味着它们都不可用)将显示用户登录)。

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM