2016-05-04 2 views
1

Я давно застрял в этой проблеме, и я не знаю, почему он не работает, я искал в Интернете и не могу найти решение. Всякий раз, когда я регистрирую пользователя, он просто возвращается к /register без ошибок. Я могу успешно php artisan migrate, и он создает таблицы в моем db в mysql.Fresh Install Laravel 5.2 Make: Auth onRegister ничего не делает

Любая помощь будет оценена по достоинству?

Маршруты:

Route::group(['middleware' => 'web'], function() { 
Route::get('/', '[email protected]index'); 
Route::auth(); 
}); 

Спасибо.

Примечание: на дисплее не появляется ошибка.

register.blade.php

@extends('layouts.app') 

@section('content') 
<div class="container"> 
    <div class="row"> 
     <div class="col-md-8 col-md-offset-2"> 
      <div class="panel panel-default"> 
       <div class="panel-heading">Register</div> 
       <div class="panel-body"> 
        <form class="form-horizontal" role="form" method="POST" action="{{ url('/register') }}"> 
         {!! csrf_field() !!} 

         <div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}"> 
          <label class="col-md-4 control-label">Name</label> 

          <div class="col-md-6"> 
           <input type="text" class="form-control" name="name" value="{{ old('name') }}"> 

           @if ($errors->has('name')) 
            <span class="help-block"> 
             <strong>{{ $errors->first('name') }}</strong> 
            </span> 
           @endif 
          </div> 
         </div> 

         <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}"> 
          <label class="col-md-4 control-label">E-Mail Address</label> 

          <div class="col-md-6"> 
           <input type="email" class="form-control" name="email" value="{{ old('email') }}"> 

           @if ($errors->has('email')) 
            <span class="help-block"> 
             <strong>{{ $errors->first('email') }}</strong> 
            </span> 
           @endif 
          </div> 
         </div> 

         <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}"> 
          <label class="col-md-4 control-label">Password</label> 

          <div class="col-md-6"> 
           <input type="password" class="form-control" name="password"> 

           @if ($errors->has('password')) 
            <span class="help-block"> 
             <strong>{{ $errors->first('password') }}</strong> 
            </span> 
           @endif 
          </div> 
         </div> 

         <div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}"> 
          <label class="col-md-4 control-label">Confirm Password</label> 

          <div class="col-md-6"> 
           <input type="password" class="form-control" name="password_confirmation"> 

           @if ($errors->has('password_confirmation')) 
            <span class="help-block"> 
             <strong>{{ $errors->first('password_confirmation') }}</strong> 
            </span> 
           @endif 
          </div> 
         </div> 

         <div class="form-group"> 
          <div class="col-md-6 col-md-offset-4"> 
           <button type="submit" class="btn btn-primary"> 
            <i class="fa fa-btn fa-user"></i>Register 
           </button> 
          </div> 
         </div> 
        </form> 
       </div> 
      </div> 
     </div> 
    </div> 
</div> 
@endsection 

AuthController.php

<?php 

namespace App\Http\Controllers\Auth; 

use App\User; 
use Validator; 
use App\Http\Controllers\Controller; 
use Illuminate\Foundation\Auth\ThrottlesLogins; 
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers; 

class AuthController extends Controller 
{ 
    /* 
    |-------------------------------------------------------------------------- 
    | Registration & Login Controller 
    |-------------------------------------------------------------------------- 
    | 
    | This controller handles the registration of new users, as well as the 
    | authentication of existing users. By default, this controller uses 
    | a simple trait to add these behaviors. Why don't you explore it? 
    | 
    */ 

    use AuthenticatesAndRegistersUsers, ThrottlesLogins; 

    /** 
    * Where to redirect users after login/registration. 
    * 
    * @var string 
    */ 
    protected $redirectTo = '/'; 

    /** 
    * Create a new authentication controller instance. 
    * 
    * @return void 
    */ 
    public function __construct() 
    { 
     $this->middleware($this->guestMiddleware(), ['except' => 'logout']); 
    } 

    /** 
    * Get a validator for an incoming registration request. 
    * 
    * @param array $data 
    * @return \Illuminate\Contracts\Validation\Validator 
    */ 
    protected function validator(array $data) 
    { 
     return Validator::make($data, [ 
      'name' => 'required|max:255', 
      'email' => 'required|email|max:255|unique:users', 
      'password' => 'required|min:6|confirmed', 
     ]); 
    } 

    /** 
    * Create a new user instance after a valid registration. 
    * 
    * @param array $data 
    * @return User 
    */ 
    protected function create(array $data) 
    { 
     return User::create([ 
      'name' => $data['name'], 
      'email' => $data['email'], 
      'password' => bcrypt($data['password']), 
     ]); 
    } 
} 
+0

Вы изменили представление и файлы контроллера после того, как вы сделали php artisan make: auth? share ur view и ur controller pls –

+0

Хорошо. Какие взгляды вы хотите увидеть? – swagster

+0

/register and AUthcontroller –

ответ

0

Попробуйте удалить web промежуточное программное обеспечение от routes.phpif you're on 5.2.27 or higher.

Route::auth(); 
Route::get('/', '[email protected]'); 
+0

Сделал это, все еще не вернув ничего на '/ register' – swagster

+0

Когда вы имеете в виду remove' web', вы имеете в виду строку '['middleware' => 'web']'? – swagster

+0

Вы можете удалить целое предложение 'group'. –