estoy intentando hacer un modulo de login personalizado basado en el login por defecto(Route::auth()), pero de algún modo, aparecen los mensajes correspondientes a unas reglas de validacion 'required', en los dos campos, email y password, el problema es que no se donde se estan aplicando las reglas de validacion. Este error me pasa también en el login por defecto.
FORMULARIO
@section('contenido')
<div class="row">
<div class="col-md-12">
@if(count($errors) > 0)
<div class="alert alert-danger alert-dismissible fade in" role=alert >
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<ul>
@foreach($errors->all() as $errores)
<li style="font-weight: bolder; list-style-type: none">{{$errores}}</li>
@endforeach
</ul>
</div>
@endif
</div>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
@if(count($errors) > 0)
<div class="alert alert-danger alert-dismissible fade in" role=alert >
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<ul>
@foreach($errors->all() as $errores)
<li style="font-weight: bolder; list-style-type: none">{{$errores}}</li>
@endforeach
</ul>
</div>
@endif
</div>
</div>
</div>
<div id="superespacio"></div>
<div class="container">
<div class="row">
{{Form::open(array('url' => 'login', 'method'=>'POST','class'=>"form-horizontal"))}}
<div class="form-group">
{!! Form::label('Correo Electronico', null, array('class' => 'col-sm-2 control-label')) !!}
<div class="col-sm-10">
{!! Form::text('correo', null, array('class' => 'form-control','placeholder' =>'Introduce tu Correo Electronico')) !!}
</div>
</div>
<div class="form-group">
{!! Form::label('Contraseña', null, array('class' => 'col-sm-2 control-label')) !!}
<div class="col-sm-10">
{!! Form::text('pass', null, array('class' => 'form-control','placeholder' =>'Introduce tu Contraseña')) !!}
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
{!! Form::submit('Inicia Session', ['class'=>'btn btn-default']) !!}
</div>
</div>
{{ Form::close() }}
</div>
</div>
<div id="superespacio"></div>
@endsection
MODULO AUTHCONTROLLER(EL QUE VIENE POR DEFECTO)
<
?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',
// 'correo' => 'required|unique:users',
// 'pass' => 'required|min:6',
//|email|max:255
//|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['correo'],
'password' => bcrypt($data['pass']),
]);
}
}
Como veis en este modulo tengo desactivadas todas las reglas de validacion, pues aun asi me intenta validar el correo y el password.
En el trait AuthenticatesUsers He intentado comentar esta linea a ver si era por eso, mismo resultado
protected function validateLogin(Request $request)
{
$this->validate($request, [
//$this->loginUsername() => 'required', 'password' => 'required',
]);
}
La ruta
Route::auth();
Route::group(['middleware'=>'auth'], function() {
Route::resource('usuarios', 'UsuariosController');
});
La ruta funciona bien, al darle al link de usuarios te envia al middleware, pero como digo no paso del login al home, en la pantalla de validacion, aun rellenando los campos, me pone el mensaje de 'required'
/*****************************DESPUES DE EDICION******************** MODELO USER
<?php
namespace App;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $table = 'users';
protected $fillable = [
'name', 'email', 'password','tipo',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
public function articulos($value='')
{
return $this->hasMany('App\modelos\articulo');
}
}