mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-27 17:31:09 -06:00
50 lines
1.0 KiB
PHP
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',
|
|
]
|
|
);
|
|
}
|
|
|
|
}
|