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

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