123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- namespace App\Http\Controllers;
- use App\User;
- use Illuminate\Http\Request;
- class RegistrationController extends Controller
- {
- public function create()
- {
- return view('registration.create');
- }
- public function store(Request $request)
- {
- // Validate submitted data.
- $this->validate($request, [
- 'name' => 'required',
- 'email' => 'required|email',
- // "confirmed" uses <field>_confirmation.
- 'password' => 'required|confirmed',
- ]);
- // Create user. This would give us a clear password.
- // $user = User::create($request->only(['name', 'email', 'password']));
- $user = User::create([
- 'name' => $request->get('name'),
- 'email' => $request->get('email'),
- 'password' => bcrypt($request->get('password')),
- ]);
- // Sign user in.
- auth()->login($user);
- // Redirect to home page.
- return redirect()->home();
- }
- }
|