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

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