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

Размер файла: 940B
  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 Rating
  11. *
  12. * @property int id
  13. * @property int user_id
  14. * @property int recipient_id
  15. * @property string text
  16. * @property string vote
  17. * @property int created_at
  18. */
  19. class Rating extends BaseModel
  20. {
  21. /**
  22. * The table associated with the model.
  23. *
  24. * @var string
  25. */
  26. protected $table = 'rating';
  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 recipient(): BelongsTo
  48. {
  49. return $this->belongsTo(User::class, 'recipient_id')->withDefault();
  50. }
  51. }