Storage::disk(self::DISK)->delete($file->path)); } /** * @return BelongsTo */ public function page(): BelongsTo { return $this->belongsTo(Page::class); } public function url(): string { return route('pages.file', ['file' => $this->id, 'name' => $this->name]); } /** * @return array{id: int, name: string, size: int, extension: string, url: string} */ public function toBlockArray(): array { return [ 'id' => $this->id, 'name' => $this->name, 'size' => (int) $this->size, 'extension' => strtoupper(pathinfo($this->name, PATHINFO_EXTENSION)), 'url' => $this->url(), ]; } }