<?php
namespace App\Http\Controllers\Auth;
use App\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Redirect;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ThrottlesLogins;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
class AuthController extends Controller
{
use AuthenticatesAndRegistersUsers, ThrottlesLogins;
public function __construct()
{
$this->middleware('guest', ['except' => 'getLogout']);
}
protected function validator(array $data)
{
return Validator::make($data, [
'login' => 'required|max:255',
'email' => 'required|email|max:255|unique:users',
'pass' => 'required|confirmed|min:6',
]);
}
protected function create(array $data)
{
$user=new User;
$user->login= $data['login'];
$user->email=$data['email'];
$user->pass=bcrypt($data['pass']);
$user->save();
}
public function authenticate(Request $request)
{
$validator = Validator::make($request->all(), [
'login'=>'required',
'pass'=>'required'
]);
$credentials = $this->getCredentials($request);
if ($validator->fails()) {
return Redirect::to('auth/login')
->withErrors($validator)
->withInput();
} else {
if (Auth::attempt($credentials)) {
return redirect()->intended('home');
}
return Redirect::to('auth/login')
->withErrors('Wrong login/pass');
}
}
protected function getCredentials(Request $request)
{
return $request->only('login', 'pass');
}
}
От сюда видно что login и pass это не стандартные email и password,как быть?неужели ларавел не предусмотрел для этого интерфейсов?