fails()) $errors = $v->messages()->all(); else { $user = User::registration($data); Auth::login($user, true); return Redirect::to('/'); } } return View::make('auth.registration', [ 'title' => 'Регистрация', 'errors' => $errors ]); } public function login() { $errors = []; if (Request::isMethod('post')) { $data = Input::all(); if (Session::token() != $data['_token']) exit("The token doesn't match!"); $v = User::LogValidate($data); if ($v->fails()) $errors = $v->messages()->all(); else { if (Auth::attempt([ 'email' => $data['email'], 'password' => $data['password'] ], true))return Redirect::to('/'); else $errors = ['Неверный Email или пароль!']; } } return View::make('auth.login', [ 'title' => 'Авторизация', 'errors' => $errors ]); } }