Squashed commit of the following: commit e6e0ea2e6e0db9637ae67dfa913ec42f7f08b81e Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Oct 19 21:49:59 2016 +0100 Remove needless .gitkeep files commit 1c7704b2913c689c6cad0eb934787e9fedf0f4fa Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Oct 19 21:48:47 2016 +0100 Use fullpath import for the validator facade commit dbc28853b6712ba040394cf9943a1a8de85bf44c Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Oct 19 21:46:07 2016 +0100 Add redirectTo attribute to the reset password controller commit 0555680e24c0175acce0be66a2f332c5fa4b35a1 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Oct 19 21:44:00 2016 +0100 Ignore Passport-generated OAuth keys commit 1be872180c52bc267cd43f3a7b8e2b49b4c6f023 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Oct 19 21:41:42 2016 +0100 Fixing typehint commit d72b783f8511898fe13fbb99fa5739a846801db9 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Oct 19 21:40:35 2016 +0100 fix spacing commit 4870a56fbe273a37ce67203c0e0aed857dccbb1f Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Oct 19 21:39:54 2016 +0100 Add typehint for factory
71 lines
1.8 KiB
PHP
71 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Auth;
|
|
|
|
use App\User;
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Support\Facades\Validator;
|
|
use Illuminate\Foundation\Auth\RegistersUsers;
|
|
|
|
class RegisterController extends Controller
|
|
{
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Register Controller
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| This controller handles the registration of new users as well as their
|
|
| validation and creation. By default this controller uses a trait to
|
|
| provide this functionality without requiring any additional code.
|
|
|
|
|
*/
|
|
|
|
use RegistersUsers;
|
|
|
|
/**
|
|
* Where to redirect users after login / registration.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $redirectTo = '/home';
|
|
|
|
/**
|
|
* Create a new controller instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
$this->middleware('guest');
|
|
}
|
|
|
|
/**
|
|
* Get a validator for an incoming registration request.
|
|
*
|
|
* @param array $data
|
|
* @return \Illuminate\Contracts\Validation\Validator
|
|
*/
|
|
protected function validator(array $data)
|
|
{
|
|
return Validator::make($data, [
|
|
'name' => 'required|max:255',
|
|
'email' => 'required|email|max:255|unique:users',
|
|
'password' => 'required|min:6|confirmed',
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Create a new user instance after a valid registration.
|
|
*
|
|
* @param array $data
|
|
* @return User
|
|
*/
|
|
protected function create(array $data)
|
|
{
|
|
return User::create([
|
|
'name' => $data['name'],
|
|
'email' => $data['email'],
|
|
'password' => bcrypt($data['password']),
|
|
]);
|
|
}
|
|
}
|