Advertisement
Guest User

Untitled

a guest
Jul 17th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. public function update($id, ClientUserUpdateRequest $request)
  2. {
  3. $repository = new ClientUserRepository();
  4.  
  5. $toSend = $request->all();
  6. $user = $repository->findByLocalId($id, \Auth::id());
  7.  
  8.  
  9. $toSend['client_id'] = \Auth::id();
  10. $toSend['local_id'] = $id;
  11.  
  12. if (isset($toSend['password'])) {
  13. $toSend['password'] = \Hash::make($toSend['password']);
  14. }
  15.  
  16. if (is_null($user)) {
  17. return $this->formatResponse($repository->create($toSend));
  18. }
  19.  
  20. return $this->formatResponse($repository->update($user->id, $toSend));
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement