'integer', 'scanned_at' => 'datetime', ]; } public function device(): BelongsTo { return $this->belongsTo(Device::class); } public function note(): BelongsTo { return $this->belongsTo(Note::class); } public static function itemKey(array $item, int $index = 0): string { $native = $item['native_id'] ?? null; if ($native !== null && $native !== '') { return 'n:'.(string) $native; } return 'h:'.substr(hash('sha1', (string) ($item['title'] ?? '').'|'.(string) ($item['body'] ?? '')), 0, 24); } public const HASH_VERSION = '2'; public static function itemHash(array $item): string { return hash('sha256', self::HASH_VERSION."\n".(string) ($item['title'] ?? '')."\n".(string) ($item['body'] ?? '')); } }