book_count === 1) { return self::TYPE_BOOK; } elseif ($this->chapter_count === 1) { return self::TYPE_CHAPTER; } return self::TYPE_PAGE; } public function getSizeString(): string { $mb = round($this->size / 1000000, 2); return "{$mb} MB"; } /** * Get the URL to view/continue this import. */ public function getUrl(string $path = ''): string { $path = ltrim($path, '/'); return url("/import/{$this->id}" . ($path ? '/' . $path : '')); } public function logDescriptor(): string { return "({$this->id}) {$this->name}"; } public function createdBy(): BelongsTo { return $this->belongsTo(User::class, 'created_by'); } }