User.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. ];
  32. /**
  33. * The attributes that should be hidden for arrays.
  34. *
  35. * @var array
  36. */
  37. protected $hidden = [
  38. 'password', 'remember_token',
  39. ];
  40. /**
  41. * The attributes that should be cast to native types.
  42. *
  43. * @var array
  44. */
  45. protected $casts = [
  46. 'email_verified_at' => 'datetime',
  47. ];
  48. public function country_name()
  49. {
  50. return $this->belongsTo(Country::class, 'nationality', 'id');
  51. }
  52. public function department_name()
  53. {
  54. return $this->belongsTo('App\Models\Department', 'department');
  55. }
  56. public function university()
  57. {
  58. return $this->belongsTo('App\Models\University', 'university_name');
  59. }
  60. }