Advertisement
Guest User

Untitled

a guest
May 26th, 2015
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.31 KB | None | 0 0
  1. <?php namespace Api\Entity;
  2.  
  3. use Api\Model\User;
  4. use DeSmart\DomainCore\Entity\AbstractEloquentEntity;
  5. use Illuminate\Contracts\Auth\Authenticatable;
  6. use Illuminate\Contracts\Support\Arrayable;
  7.  
  8. class UserEntity extends AbstractEloquentEntity implements Arrayable, Authenticatable
  9. {
  10. /**
  11. * Tworzy nową encje na podstawie danych pobranych z Facebooka.
  12. *
  13. * @param string $facebookId
  14. * @param string $email
  15. * @param string $gender
  16. * @param string $firstName
  17. * @param string $lastName
  18. * @param bool $acceptedTerms
  19. * @return self
  20. * @static
  21. */
  22. public static function createNewUser($facebookId, $email, $gender, $firstName, $lastName, $acceptedTerms)
  23. {
  24. $entity = new static(new User);
  25.  
  26. $entity->setFacebookId($facebookId);
  27. $entity->setEmail($email);
  28. $entity->setGender($gender);
  29. $entity->setFirstName($firstName);
  30. $entity->setLastName($lastName);
  31. $entity->setAcceptedTerms($acceptedTerms);
  32.  
  33. return $entity;
  34. }
  35.  
  36. /**
  37. * Get the instance as an array.
  38. *
  39. * @return array
  40. */
  41. public function toArray()
  42. {
  43. return $this->model->toArray();
  44. }
  45.  
  46. /**
  47. * Get the unique identifier for the user.
  48. *
  49. * @return mixed
  50. */
  51. public function getAuthIdentifier()
  52. {
  53. return $this->model->getAuthIdentifier();
  54. }
  55.  
  56. /**
  57. * Get the password for the user.
  58. *
  59. * @return string
  60. */
  61. public function getAuthPassword()
  62. {
  63. return $this->model->getAuthPassword();
  64. }
  65.  
  66. /**
  67. * Get the token value for the "remember me" session.
  68. *
  69. * @return string
  70. */
  71. public function getRememberToken()
  72. {
  73. return $this->model->getRememberToken();
  74. }
  75.  
  76. /**
  77. * Set the token value for the "remember me" session.
  78. *
  79. * @param string $value
  80. * @return void
  81. */
  82. public function setRememberToken($value)
  83. {
  84. $this->model->setRememberToken($value);
  85. }
  86.  
  87. /**
  88. * Get the column name for the "remember me" token.
  89. *
  90. * @return string
  91. */
  92. public function getRememberTokenName()
  93. {
  94. return $this->model->getRememberTokenName();
  95. }
  96.  
  97. /**
  98. * @return int
  99. */
  100. public function getId()
  101. {
  102. return $this->model->getKey();
  103. }
  104.  
  105. /**
  106. * @param int $id
  107. * @return self
  108. */
  109. public function setId($id)
  110. {
  111. $this->model->id = $id;
  112.  
  113. return $this;
  114. }
  115.  
  116. /**
  117. * @return string
  118. */
  119. public function getFacebookId()
  120. {
  121. return $this->model->facebook_id;
  122. }
  123.  
  124. /**
  125. * @param string $facebookId
  126. * @return self
  127. */
  128. public function setFacebookId($facebookId)
  129. {
  130. $this->model->facebook_id = $facebookId;
  131.  
  132. return $this;
  133. }
  134.  
  135. /**
  136. * @return string
  137. */
  138. public function getEmail()
  139. {
  140. return $this->model->email;
  141. }
  142.  
  143. /**
  144. * @param string $email
  145. * @return self
  146. */
  147. public function setEmail($email)
  148. {
  149. $this->model->email = $email;
  150.  
  151. return $this;
  152. }
  153.  
  154. /**
  155. * @return string
  156. */
  157. public function getGender()
  158. {
  159. return $this->model->gender;
  160. }
  161.  
  162. /**
  163. * @param string $gender
  164. * @return self
  165. */
  166. public function setGender($gender)
  167. {
  168. $this->model->gender = $gender;
  169.  
  170. return $this;
  171. }
  172.  
  173. /**
  174. * @return string
  175. */
  176. public function getFirstName()
  177. {
  178. return $this->model->first_name;
  179. }
  180.  
  181. /**
  182. * @param string $firstName
  183. * @return self
  184. */
  185. public function setFirstName($firstName)
  186. {
  187. $this->model->first_name = $firstName;
  188.  
  189. return $this;
  190. }
  191.  
  192. /**
  193. * @return string
  194. */
  195. public function getLastName()
  196. {
  197. return $this->model->last_name;
  198. }
  199.  
  200. /**
  201. * @param string $lastName
  202. * @return self
  203. */
  204. public function setLastName($lastName)
  205. {
  206. $this->model->last_name = $lastName;
  207.  
  208. return $this;
  209. }
  210.  
  211. /**
  212. * @return bool
  213. */
  214. public function isAcceptedTerms()
  215. {
  216. return $this->model->is_accepted_terms;
  217. }
  218.  
  219. /**
  220. * @param bool $acceptedTerms
  221. * @return bool
  222. */
  223. public function setAcceptedTerms($acceptedTerms)
  224. {
  225. $this->model->is_accepted_terms = $acceptedTerms;
  226.  
  227. return $this;
  228. }
  229. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement