Created
July 24, 2014 10:02
-
-
Save whisher/6f3874072c0a8cdb5412 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Try to login user. | |
| * | |
| * @return json | |
| */ | |
| public function store() | |
| { | |
| $isValid = $this->signinForm->valid(Input::only('email', 'password', 'remember')); | |
| if ($isValid) { | |
| $result = $this->session->store($this->signinForm->data()); | |
| if (isset($result['user']) && ($result['success'] > 0)) { | |
| Event::fire('session.login', array('data'=>$result['user'])); | |
| return Response::json($result, 200); | |
| } | |
| $error = isset($result['error'])?array_pop($result):trans('session.invalid'); | |
| return Response::json(array( | |
| 'success' => 0, | |
| 'errors' => array('error' => array($error))), 200); | |
| } | |
| return Response::json(array( | |
| 'success' => 0, | |
| 'errors' => $this->signinForm->errors()), 200 | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment