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

Размер файла: 1.24Kb
  1. <?php
  2.  
  3. namespace App\Models;
  4.  
  5. use Faker\Provider\Base;
  6. use Illuminate\Database\Eloquent\Factories\HasFactory;
  7. use Illuminate\Database\Eloquent\Model;
  8. use Illuminate\Database\Eloquent\Relations\BelongsTo;
  9.  
  10. /**
  11. * Class Guestbook
  12. *
  13. * @property int id
  14. * @property int user_id
  15. * @property string text
  16. * @property string ip
  17. * @property string brow
  18. * @property int created_at
  19. * @property string reply
  20. * @property int edit_user_id
  21. * @property bool active
  22. * @property int updated_at
  23. */
  24. class Guestbook extends BaseModel
  25. {
  26. use HasFactory;
  27.  
  28. /**
  29. * The table associated with the model.
  30. *
  31. * @var string
  32. */
  33. protected $table = 'guestbook';
  34.  
  35. /**
  36. * Indicates if the model should be timestamped.
  37. *
  38. * @var bool
  39. */
  40. public $timestamps = false;
  41.  
  42. /**
  43. * The attributes that aren't mass assignable.
  44. *
  45. * @var array
  46. */
  47. protected $guarded = [];
  48.  
  49. /**
  50. * Morph name
  51. *
  52. * @var string
  53. */
  54. public static $morphName = 'guestbook';
  55.  
  56. /**
  57. * Возвращает связь пользователей
  58. *
  59. * @return BelongsTo
  60. */
  61. public function editUser(): BelongsTo
  62. {
  63. return $this->belongsTo(User::class, 'edit_user_id')->withDefault();
  64. }
  65. }