Advertisement
Guest User

Untitled

a guest
Dec 15th, 2015
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.98 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Http\Controllers\Auth;
  4.  
  5. use App\User;
  6. use Validator;
  7. use App\Http\Controllers\Controller;
  8. use Illuminate\Foundation\Auth\ThrottlesLogins;
  9. use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
  10.  
  11. class AuthController extends Controller
  12. {
  13.     /*
  14.     |--------------------------------------------------------------------------
  15.     | Registration & Login Controller
  16.     |--------------------------------------------------------------------------
  17.     |
  18.     | This controller handles the registration of new users, as well as the
  19.     | authentication of existing users. By default, this controller uses
  20.     | a simple trait to add these behaviors. Why don't you explore it?
  21.     |
  22.     */
  23.  
  24.     use AuthenticatesAndRegistersUsers, ThrottlesLogins;
  25.  
  26.     /**
  27.      * Create a new authentication controller instance.
  28.      *
  29.      * @return void
  30.      */
  31.     public function __construct()
  32.     {
  33.         $this->middleware('guest', ['except' => 'getLogout']);
  34.     }
  35.  
  36.     /**
  37.      * Get a validator for an incoming registration request.
  38.      *
  39.      * @param  array  $data
  40.      * @return \Illuminate\Contracts\Validation\Validator
  41.      */
  42.     protected function validator(array $data)
  43.     {
  44.         return Validator::make($data, [
  45.             'name' => 'required|max:255',
  46.             'email' => 'required|email|max:255|unique:users',
  47.             'password' => 'required|confirmed|min:6',
  48.         ]);
  49.     }
  50.  
  51.     /**
  52.      * Create a new user instance after a valid registration.
  53.      *
  54.      * @param  array  $data
  55.      * @return User
  56.      */
  57.     protected function create(array $data)
  58.     {
  59.         return User::create([
  60.             'name' => $data['name'],
  61.             'email' => $data['email'],
  62.             'password' => bcrypt($data['password']),
  63.         ]);
  64.     }
  65.  
  66.     /**
  67.      * Get the post register / login redirect path.
  68.      *
  69.      * @return string
  70.      */
  71.     public function redirectPath()
  72.     {
  73.         return route('home');
  74.     }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement