firefly-iii/app/Services/Registrar.php

51 lines
1.1 KiB
PHP
Raw Normal View History

2015-02-05 21:52:16 -06:00
<?php namespace FireflyIII\Services;
2015-02-05 21:39:52 -06:00
2015-02-05 21:52:16 -06:00
use FireflyIII\User;
2015-02-05 21:39:52 -06:00
use Illuminate\Contracts\Auth\Registrar as RegistrarContract;
2015-02-07 15:50:47 -06:00
use Validator;
2015-02-05 21:39:52 -06:00
2015-02-11 00:35:10 -06:00
/**
* Class Registrar
*
2015-05-10 01:26:42 -05:00
* @codeCoverageIgnore
2015-02-11 00:35:10 -06:00
* @package FireflyIII\Services
*/
2015-02-07 15:50:47 -06:00
class Registrar implements RegistrarContract
{
2015-02-05 21:39:52 -06:00
2015-02-07 15:50:47 -06:00
/**
* 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'],
2015-02-27 09:08:46 -06:00
'password' => $data['password'],
2015-02-07 15:50:47 -06:00
]
);
}
2015-02-05 21:39:52 -06:00
2015-02-07 15:50:47 -06:00
/**
* 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, [
2015-06-06 16:09:12 -05:00
'email' => 'required|email|max:255|unique:users',
'password' => 'required|confirmed|min:6',
]
2015-02-07 15:50:47 -06:00
);
}
2015-02-05 21:39:52 -06:00
}