User.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. }