public function postLogin(LoginRequest $loginRequest) { $customJsonResponse = new CustomJsonResponse(); try { $query = new Factories\AnunciandoQuery(); $userRepository = new UserRepository($query); $user = $userRepository->getUserDetailByLogin($loginRequest->username, $loginRequest->password); if ($user != null) { $customJsonResponse->setData($user->toJson()); } else { $customJsonResponse->setStatusCode(500); $customJsonResponse->setErrorMessage('Usuário e/ou senha inválido(s).'); } $query->dispose(); } catch (\Exception $exception) { $customJsonResponse->setErrorMessage(var_dump($exception)); } return $this->response($customJsonResponse); }
<html data-ng-app="anunciando-app"> <head> <meta charset="utf-8" /> <title>@yield('title') - anunciando.com</title> <!-- <link href="//fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css" /> --> <link rel="stylesheet" href="<% asset('/css/bootstrap-3.3.4.css') %>" /> <link rel="stylesheet" href="<% asset('/css/main.css') %>" /> </head> <body> <?php include '..\\Database\\Factories\\AnunciandoQuery.php'; use Database\Factories; use App\Repositories\UserRepository; $query = new Factories\AnunciandoQuery(); $userRepository = new UserRepository($query); $user1 = $userRepository->getUserDetailByUsername('admin'); $user2 = $userRepository->getUserDetailByLogin('admin', 123); $query->dispose(); ?> <div class="loading-background"></div> <div class="loading"> <div class="loading-message"> <!-- <img alt="" src="http://www.ajaxload.info/images/exemples/26.gif" /> --> <p data-ng-bind="loadingMessage"></p> </div> </div> @yield('content')