/** * Create manager login. * * @param LoginRequest $request * @param ManagerRepository $repository * @return \Illuminate\Http\RedirectResponse */ public function postLogin(LoginRequest $request, ManagerRepository $repository) { $manager = $request->resolveManager(); $repository->login($manager, $request->remember); flash()->success(trans('messages.login.title', ['name' => $manager->name]), trans('messages.login.content')); return isset($request->ref) ? redirect($request->ref) : redirect($this->redirectPath); }
/** * Validate manager login. * * @param ManagerRepository $repository Manager repository * * @return bool */ public function checkLogin(ManagerRepository $repository) { if ($this->email && $this->password) { $this->resolvedManager = $repository->getByLogin($this->email, $this->password); return !empty($this->resolvedManager); } return true; }