User.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace App\Models;
  3. use App\Models\Application;
  4. use App\Models\Review;
  5. use Illuminate\Database\Eloquent\Relations\HasMany;
  6. use Illuminate\Database\Eloquent\Factories\HasFactory;
  7. use Illuminate\Foundation\Auth\User as Authenticatable;
  8. use Illuminate\Notifications\Notifiable;
  9. class User extends Authenticatable
  10. {
  11. /** @use HasFactory<\Database\Factories\UserFactory> */
  12. use HasFactory, Notifiable;
  13. /**
  14. * The attributes that are mass assignable.
  15. *
  16. * @var list<string>
  17. */
  18. protected $fillable = [
  19. 'login',
  20. 'full_name',
  21. 'phone',
  22. 'email',
  23. 'password',
  24. ];
  25. /**
  26. * The attributes that should be hidden for serialization.
  27. *
  28. * @var list<string>
  29. */
  30. protected $hidden = [
  31. 'password',
  32. ];
  33. /**
  34. * Get the attributes that should be cast.
  35. *
  36. * @return array<string, string>
  37. */
  38. protected function casts(): array
  39. {
  40. return [
  41. 'password' => 'hashed',
  42. ];
  43. }
  44. public function application(): HasMany
  45. {
  46. return $this->hasMany(Application::class);
  47. }
  48. public function review(): HasMany
  49. {
  50. return $this->hasMany(Review::class);
  51. }
  52. }