1 개요

라라벨 AuthController

https://www.plantuml.com/plantuml/img/ut8iBSb8pIl9J4uiIIqEBKujAbQmgT7LLGXAJSaiIaqkWOXn1QMcPnQN05cubQ2Ov9YNWaqB5jk8qeSg1jRYd9zNKfIVavDQXCLe36EmQWd9ACelASb9BVR9Jy_C0pe50000

2 소스 코드

<?php

namespace App\\Http\\Controllers\\Auth;

use App\\User;
use Validator;
use App\\Http\\Controllers\\Controller;
use Illuminate\\Foundation\\Auth\\ThrottlesLogins;
use Illuminate\\Foundation\\Auth\\AuthenticatesAndRegistersUsers;

class AuthController extends Controller
{
    use AuthenticatesAndRegistersUsers, ThrottlesLogins;
    protected $redirectTo = '/';

    public function __construct()
    {
        $this->middleware($this->guestMiddleware(), ['except' => 'logout']);
    }

    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',
        ]);
    }

    protected function create(array $data)
    {
        return User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => bcrypt($data['password']),
        ]);
    }
}

3 관련 route

Untitled