| 8 | use Illuminate\Foundation\Auth\RegistersUsers; |
| 9 | |
| 10 | class RegisterController extends Controller |
| 11 | { |
| 12 | /* |
| 13 | |-------------------------------------------------------------------------- |
| 14 | | Register Controller |
| 15 | |-------------------------------------------------------------------------- |
| 16 | | |
| 17 | | This controller handles the registration of new users as well as their |
| 18 | | validation and creation. By default this controller uses a trait to |
| 19 | | provide this functionality without requiring any additional code. |
| 20 | | |
| 21 | */ |
| 22 | |
| 23 | use RegistersUsers; |
| 24 | |
| 25 | /** |
| 26 | * Where to redirect users after registration. |
| 27 | * |
| 28 | * @var string |
| 29 | */ |
| 30 | protected $redirectTo = '/home'; |
| 31 | |
| 32 | /** |
| 33 | * Create a new controller instance. |
| 34 | * |
| 35 | * @return void |
| 36 | */ |
| 37 | public function __construct() |
| 38 | { |
| 39 | $this->middleware('guest'); |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Get a validator for an incoming registration request. |
| 44 | * |
| 45 | * @param array $data |
| 46 | * @return \Illuminate\Contracts\Validation\Validator |
| 47 | */ |
| 48 | protected function validator(array $data) |
| 49 | { |
| 50 | return Validator::make($data, [ |
| 51 | 'name' => 'required|string|max:255', |
| 52 | 'email' => 'required|string|email|max:255|unique:users', |
| 53 | 'password' => 'required|string|min:6|confirmed', |
| 54 | ]); |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Create a new user instance after a valid registration. |
| 59 | * |
| 60 | * @param array $data |
| 61 | * @return \App\User |
| 62 | */ |
| 63 | protected function create(array $data) |
| 64 | { |
| 65 | return User::create([ |
| 66 | 'name' => $data['name'], |
| 67 | 'email' => $data['email'], |
nothing calls this directly
no outgoing calls
no test coverage detected