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

Размер файла: 883B
  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 Wall
  11. *
  12. * @property int id
  13. * @property int user_id
  14. * @property int author_id
  15. * @property string text
  16. * @property int created_at
  17. */
  18. class Wall 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. * Morph name
  36. *
  37. * @var string
  38. */
  39. public static $morphName = 'walls';
  40.  
  41. /**
  42. * Возвращает связь пользователей
  43. *
  44. * @return BelongsTo
  45. */
  46. public function author(): BelongsTo
  47. {
  48. return $this->belongsTo(User::class, 'author_id')->withDefault();
  49. }
  50. }