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

Размер файла: 934B
  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 Sticker
  11. *
  12. * @property int id
  13. * @property int category_id
  14. * @property string name
  15. * @property string code
  16. */
  17. class Sticker 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. * @var string
  37. */
  38. public $uploadPath = '/uploads/stickers';
  39.  
  40. /**
  41. * Возвращает связь категории стикеров
  42. *
  43. * @return BelongsTo
  44. */
  45. public function category(): BelongsTo
  46. {
  47. return $this->belongsTo(StickersCategory::class, 'category_id')->withDefault();
  48. }
  49. }