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

Размер файла: 956B
  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 Dialogue
  11. *
  12. * @property int id
  13. * @property int message_id
  14. * @property int user_id
  15. * @property int author_id
  16. * @property string type
  17. * @property int reading
  18. * @property int created_at
  19. */
  20. class Dialogue extends BaseModel
  21. {
  22. public const IN = 'in'; // Принятые
  23. public const OUT = 'out'; // Отправленные
  24.  
  25. /**
  26. * Indicates if the model should be timestamped.
  27. *
  28. * @var bool
  29. */
  30. public $timestamps = false;
  31.  
  32. /**
  33. * The attributes that aren't mass assignable.
  34. *
  35. * @var array
  36. */
  37. protected $guarded = [];
  38.  
  39. /**
  40. * Возвращает связь пользователей
  41. *
  42. * @return BelongsTo
  43. */
  44. public function author(): BelongsTo
  45. {
  46. return $this->belongsTo(User::class, 'author_id')->withDefault();
  47. }
  48. }