简体   繁体   English

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

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

I have faced a problem with Laravel 5.2 login and register.I used here Laravel 5.2 default login.blade.php and register.blade.php .All things going well but when i trying to register any user and fill up the form and submit then it do not insert any data in database and same page show in the browser window.Browser did not showed any error though i have made debug true . 我遇到了Laravel 5.2登录和注册的问题。我在这里使用Laravel 5.2默认login.blade.phpregister.blade.php 。所有事情都顺利但当我试图注册任何用户并填写表格并提交然后它不会在数据库中插入任何数据,并且在浏览器窗口中显示相同的页面。虽然我已经使调试true但浏览器没有显示任何错误。

Here is my routes.php: 这是我的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');
});

I have read many question in Stackoverflow.But all are failed to solve my problem.Here is some link of those questions: 我在Stackoverflow中已经阅读了很多问题。但是所有问题都无法解决我的问题。这里是这些问题的一些链接:

For find solution if you need any files then please let me know.Then i will provide here. 如果你需要任何文件找到解决方案,请告诉我。然后我会在这里提供。

You've read the answer, you're just not applying it correctly. 你已经阅读了答案,你只是没有正确应用它。 Auth requires sessions. Auth需要会话。 Any route that needs session information should be inside the web middleware group. 任何需要会话信息的路由都应该在web中间件组中。

Right now, your member , members , auth/login , auth/logout , auth/register , 'home', and / routes are all outside of the web middleware group, so none of them will have session information available (meaning none of them will show users as logged in). 现在,您的membermembersauth/loginauth/logoutauth/register ,“主页”和/路由都在web中间件组之外,因此它们都不会提供会话信息(这意味着它们都不可用)将显示用户登录)。

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

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