User.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. use Illuminate\Auth\UserInterface;
  3. use Illuminate\Auth\Reminders\RemindableInterface;
  4. class User extends Eloquent implements UserInterface, RemindableInterface {
  5. /**
  6. * The database table used by the model.
  7. *
  8. * @var string
  9. */
  10. protected $table = 'users';
  11. protected $softDelete = true;
  12. /**
  13. * The attributes excluded from the model's JSON form.
  14. *
  15. * @var array
  16. */
  17. protected $hidden = array('password');
  18. /**
  19. * Get the unique identifier for the user.
  20. *
  21. * @return mixed
  22. */
  23. public function getAuthIdentifier()
  24. {
  25. return $this->getKey();
  26. }
  27. /**
  28. * Get the password for the user.
  29. *
  30. * @return string
  31. */
  32. public function getAuthPassword()
  33. {
  34. return $this->password;
  35. }
  36. /**
  37. * Get the e-mail address where password reminders are sent.
  38. *
  39. * @return string
  40. */
  41. public function getReminderEmail()
  42. {
  43. return $this->email;
  44. }
  45. public function films() {
  46. return $this->hasMany('Film', 'user');
  47. }
  48. public function comments() {
  49. return $this->hasMany('Comment', 'user');
  50. }
  51. public function votes() {
  52. return $this->hasMany('Vote', 'user');
  53. }
  54. public function news() {
  55. return $this->hasMany('News', 'author');
  56. }
  57. }