Login

You have the option to log in using the email and password. You will be prompted to this page when trying to access any page on the website while not being logged in.

          
            
            /**
            * Where to redirect users after login.
            *
            * @var string
            */
            protected $redirectTo = '/dashboard';

            /**
            * Create a new controller instance.
            *
            * @return void
            */
            public function __construct()
            {
                $this->middleware('guest')->except('logout');
            }
          
        

Validation is taken care of in App\Http\Requests\UserRequest.

          
            public function rules()
            {
                return [
                    'name' => [
                        'required', 'min:3'
                    ],
                    'email' => [
                        'required', 'email', Rule::unique((new User)->getTable())->ignore($this->route()->user->id ?? null)
                    ],
                    'role_id' => [
                        'required', 'exists:'.(new Role)->getTable().',id'
                    ],
                    'password' => [
                        $this->route()->user ? 'nullable' : 'required', 'confirmed', 'min:6'
                    ]
                ];
            }