firefly-iii/app/Services/Registrar.php
2015-02-27 16:08:46 +01:00

50 lines
1.0 KiB
PHP

<?php namespace FireflyIII\Services;
use FireflyIII\User;
use Illuminate\Contracts\Auth\Registrar as RegistrarContract;
use Validator;
/**
* Class Registrar
*
* @package FireflyIII\Services
*/
class Registrar implements RegistrarContract
{
/**
* Create a new user instance after a valid registration.
*
* @param array $data
*
* @return User
*/
public function create(array $data)
{
return User::create(
[
'email' => $data['email'],
'password' => $data['password'],
]
);
}
/**
* Get a validator for an incoming registration request.
*
* @param array $data
*
* @return \Illuminate\Contracts\Validation\Validator
*/
public function validator(array $data)
{
return Validator::make(
$data, [
'email' => 'required|email|max:255|unique:users',
'password' => 'required|confirmed|min:6',
]
);
}
}