public function files($directory)
    {
        $this->checkDirectory($directory);

        $disk = $this->disk();

        // TODO: Add a feature to exclude unwanted files.
        $files = array_map(function ($filePath) use ($disk, $directory) {
            return [
                'name'         => str_replace("$directory/", '', $filePath),
                'path'         => $filePath,
                'url'          => $disk->url($filePath),
                'mimetype'     => $disk->mimeType($filePath),
                'lastModified' => Carbon::createFromTimestamp($disk->lastModified($filePath))->toDateTimeString(),
                'visibility'   => $disk->getVisibility($filePath),
                'size'         => $disk->size($filePath),
            ];
        }, $disk->files($directory));

        return FileCollection::make($files)->exclude($this->getExcludedFiles());
    }
public function files($directory)
    {
        $this->checkDirectory($directory);

        $disk = $this->disk();

        // TODO: Add a feature to exclude unwanted files.
        $files = array_map(function ($filePath) use ($disk, $directory) {
            return [
                'name'         => str_replace("$directory/", '', $filePath),
                'path'         => $filePath,
                'url'          => $disk->url($filePath),
                'mimetype'     => $disk->mimeType($filePath),
                'lastModified' => Carbon::createFromTimestamp($disk->lastModified($filePath))->toDateTimeString(),
                'visibility'   => $disk->getVisibility($filePath),
                'size'         => $disk->size($filePath),
            ];
        }, $disk->files($directory));

        return FileCollection::make($files)->exclude($this->getExcludedFiles());
    }
public function files ( $ directory ) { $ this -> checkDirectory ( $ directory ) ; $ disk = $ this -> disk ( ) ; // TODO: Add a feature to exclude unwanted files. $ files = array_map ( function ( $ filePath ) use ( $ disk , $ directory ) { return [ 'name' => str_replace ( "$directory/" , '' , $ filePath ) , 'path' => $ filePath , 'url' => $ disk -> url ( $ filePath ) , 'mimetype' => $ disk -> mimeType ( $ filePath ) , 'lastModified' => Carbon :: createFromTimestamp ( $ disk -> lastModified ( $ filePath ) ) -> toDateTimeString ( ) , 'visibility' => $ disk -> getVisibility ( $ filePath ) , 'size' => $ disk -> size ( $ filePath ) , ] ; } , $ disk -> files ( $ directory ) ) ; return FileCollection :: make ( $ files ) -> exclude ( $ this -> getExcludedFiles ( ) ) ; }
Get a collection of all files in a directory.

@param  string  $directory

@return \Arcanesoft\Media\Entities\FileCollection
Get a collection of all files in a directory .