You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.2 KiB

  1. <?php
  2. namespace App\Models;
  3. // use Illuminate\Contracts\Auth\MustVerifyEmail;
  4. use Illuminate\Database\Eloquent\Factories\HasFactory;
  5. use Illuminate\Foundation\Auth\User as Authenticatable;
  6. use Illuminate\Notifications\Notifiable;
  7. class User extends Authenticatable
  8. {
  9. use HasFactory, Notifiable;
  10. /**
  11. * The attributes that are mass assignable.
  12. *
  13. * @var array<int, string>
  14. */
  15. protected $fillable = [
  16. 'emp_id',
  17. 'name',
  18. 'email',
  19. 'username',
  20. 'password',
  21. 'role_id',
  22. ];
  23. /**
  24. * The attributes that should be hidden for serialization.
  25. *
  26. * @var array<int, string>
  27. */
  28. protected $hidden = [
  29. 'password',
  30. 'remember_token',
  31. ];
  32. /**
  33. * Get the attributes that should be cast.
  34. *
  35. * @return array<string, string>
  36. */
  37. protected function casts(): array
  38. {
  39. return [
  40. 'email_verified_at' => 'datetime',
  41. 'password' => 'hashed',
  42. 'role_id' => 'integer',
  43. ];
  44. }
  45. /**
  46. * Get the role associated with the user.
  47. */
  48. public function role()
  49. {
  50. return $this->belongsTo(Role::class);
  51. }
  52. }