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

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