User.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. namespace App;
  3. use Illuminate\Contracts\Auth\MustVerifyEmail;
  4. use Illuminate\Foundation\Auth\User as Authenticatable;
  5. use Illuminate\Notifications\Notifiable;
  6. class User extends Authenticatable
  7. {
  8. use Notifiable;
  9. /**
  10. * The attributes that are mass assignable.
  11. *
  12. * @var array
  13. */
  14. protected $fillable = [
  15. 'first_name',
  16. 'last_name',
  17. 'name',
  18. 'nationality',
  19. 'dob',
  20. 'gender',
  21. 'email',
  22. 'password',
  23. 'phone_number',
  24. 'university_name',
  25. 'department',
  26. 'designation',
  27. 'uni_website',
  28. 'user_type',
  29. 'ref_no',
  30. 'others_department',
  31. 'status',
  32. 'remember_token',
  33. 'email_verification',
  34. 'email_verified_at',
  35. ];
  36. /**
  37. * The attributes that should be hidden for arrays.
  38. *
  39. * @var array
  40. */
  41. protected $hidden = [
  42. 'password', 'remember_token',
  43. ];
  44. /**
  45. * The attributes that should be cast to native types.
  46. *
  47. * @var array
  48. */
  49. protected $casts = [
  50. 'email_verified_at' => 'datetime',
  51. ];
  52. public function country_name()
  53. {
  54. return $this->belongsTo(Country::class, 'nationality', 'id');
  55. }
  56. public function department_name()
  57. {
  58. return $this->belongsTo('App\Models\Department', 'department');
  59. }
  60. public function university()
  61. {
  62. return $this->belongsTo('App\Models\University', 'university_name');
  63. }
  64. }