MrGoatsy

Untitled

Mar 2nd, 2021
658
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. namespace App\Http\Controllers\Auth;
  4.  
  5. use App\Http\Controllers\Controller;
  6. use App\Models\User;
  7. use Illuminate\Http\Request;
  8. use Illuminate\Support\Facades\Hash;
  9.  
  10. class RegisterController extends Controller {
  11.     public function __construct() {
  12.         $this->middleware(['guest']);
  13.     }
  14.  
  15.     public function index() {
  16.         return view('auth.register');
  17.     }
  18.  
  19.     public function store(Request $request) {
  20.         $this->validate($request, [
  21.             'name'  => [
  22.                 'required',
  23.                 'max:255'
  24.             ],
  25.             'username' => [
  26.                 'required',
  27.                 'max:255',
  28.                 'unique:users,username'
  29.             ],
  30.             'email' => [
  31.                 'required',
  32.                 'email',
  33.                 'max:255',
  34.                 'unique:users,email'
  35.             ],
  36.             'password' => [
  37.                 'required',
  38.                 'confirmed'
  39.             ]
  40.         ]);
  41.  
  42.         User::create([
  43.             'name'      => $request->name,
  44.             'username'  => $request->username,
  45.             'email'     => $request->email,
  46.             'password'  => Hash::make($request->password)
  47.         ]);
  48.  
  49.         auth()->attempt($request->only('username', 'password'));
  50.  
  51.         return redirect()->route('dashboard');
  52.     }
  53.  
  54.     public function verification() {
  55.         return view('auth.verify-email');
  56.     }
  57. }
  58.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×