*/ class VideoRepository extends StorageRepository { public function disk(): string { return Config::get(VideoConstants::DEFAULT_DISK_QUALIFIED); } /** * Return the callback to filter filesystem contents. * * @return Closure(StorageAttributes): bool */ protected function filterCallback(): Closure { return fn (StorageAttributes $file): bool => $file->isFile() && File::extension($file->path()) === 'webm'; } /** * Map filesystem files to model. * * @return Closure(StorageAttributes): Video */ protected function mapCallback(): Closure { return fn (StorageAttributes $file): Video => new Video([ Video::ATTRIBUTE_BASENAME => File::basename($file->path()), Video::ATTRIBUTE_FILENAME => File::name($file->path()), Video::ATTRIBUTE_MIMETYPE => File::mimeType($file->path()), Video::ATTRIBUTE_PATH => $file->path(), Video::ATTRIBUTE_SIZE => $file->offsetGet(StorageAttributes::ATTRIBUTE_FILE_SIZE), ]); } }