*/ use HasFactory; use SoftDeletes; public const DEFAULT_SORT_BY = 'article'; protected $fillable = [ 'image_file_id', 'article', 'calculator_name', 'kind', 'dimensions', 'fall_height', 'additional_info', 'dimension_unit', 'weight', 'volume', 'places', 'composition', 'age_group', 'max_users', 'unit', 'series', 'trademark', 'note', ]; protected $appends = ['image']; protected function casts(): array { return [ 'fall_height' => 'decimal:3', 'weight' => 'decimal:3', 'volume' => 'decimal:3', 'places' => 'integer', 'max_users' => 'integer', ]; } public function imageFile(): BelongsTo { return $this->belongsTo(File::class, 'image_file_id'); } public function documents(): BelongsToMany { return $this->belongsToMany( File::class, 'common_catalog_item_documents', )->withTimestamps(); } protected function image(): Attribute { return Attribute::make( get: fn (): string => (string) ($this->imageFile?->thumbnail_link ?? ''), ); } }