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

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