Просмотр файла app/Models/Invite.php

Размер файла: 942B
  1. <?php
  2.  
  3. declare(strict_types=1);
  4.  
  5. namespace App\Models;
  6.  
  7. use Illuminate\Database\Eloquent\Relations\BelongsTo;
  8.  
  9. /**
  10. * Class Invite
  11. *
  12. * @property int id
  13. * @property string hash
  14. * @property int user_id
  15. * @property int invite_user_id
  16. * @property int used
  17. * @property int created_at
  18. */
  19. class Invite extends BaseModel
  20. {
  21. /**
  22. * The table associated with the model.
  23. *
  24. * @var string
  25. */
  26. protected $table = 'invite';
  27.  
  28. /**
  29. * Indicates if the model should be timestamped.
  30. *
  31. * @var bool
  32. */
  33. public $timestamps = false;
  34.  
  35. /**
  36. * The attributes that aren't mass assignable.
  37. *
  38. * @var array
  39. */
  40. protected $guarded = [];
  41.  
  42. /**
  43. * Возвращает связь пользователей
  44. *
  45. * @return BelongsTo
  46. */
  47. public function inviteUser(): BelongsTo
  48. {
  49. return $this->belongsTo(User::class, 'invite_user_id')->withDefault();
  50. }
  51. }