\App\UtilFileSystem

Class FileSystem

Summary

Methods
Properties
Constants
__construct()
lists()
files()
directories()
makeDirectory()
deleteDirectory()
putFile()
putFileAs()
download()
delete()
getDirectory()
getDisk()
getDiskName()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
formatBytes()
setDirectory()
setDisk()
setDiskName()
$directory
$disk
$diskName
N/A

Properties

$directory

$directory : string

目录路径

Type

string

$disk

$disk : 

驱动

Type

$diskName

$diskName : string

驱动名称

Type

string

Methods

__construct()

__construct(string  $directory, string  $diskName = 'public') 

FileSystem constructor.

Parameters

string $directory
string $diskName

public

lists()

lists(integer  $offset, integer  $length = 100, string|null  $search = null) : \Illuminate\Support\Collection

获取列表

Parameters

integer $offset

起始页

integer $length

结束页

string|null $search

搜索项

Returns

\Illuminate\Support\Collection —

返回集合

files()

files() : \Illuminate\Support\Collection

文件列表

Returns

\Illuminate\Support\Collection

directories()

directories() : \Illuminate\Support\Collection

文件夹列表

Returns

\Illuminate\Support\Collection

makeDirectory()

makeDirectory(string  $directory) : boolean

创建文件

Parameters

string $directory

Returns

boolean

deleteDirectory()

deleteDirectory(string  $directory) : boolean

删除文件

Parameters

string $directory

Returns

boolean

putFile()

putFile(\App\Http\Requests\Admin\FileSystem\UploadRequest  $request, string  $key = 'file') : mixed

上传文件

Parameters

\App\Http\Requests\Admin\FileSystem\UploadRequest $request
string $key

Returns

mixed

putFileAs()

putFileAs(\App\Http\Requests\Admin\FileSystem\UploadRequest  $request, string  $key = 'file', string|null  $fileName = null) : mixed

指定文件名上传文件

Parameters

\App\Http\Requests\Admin\FileSystem\UploadRequest $request
string $key
string|null $fileName

Returns

mixed

download()

download(string  $file) : mixed

下载文件(流)

Parameters

string $file

Returns

mixed

delete()

delete(string|array  $paths) : boolean

删除文件

Parameters

string|array $paths

Returns

boolean

getDirectory()

getDirectory() : string

Returns

string

getDisk()

getDisk() : mixed

Returns

mixed

getDiskName()

getDiskName() : string

Returns

string

formatBytes()

formatBytes(integer  $size) : string

Parameters

integer $size

Returns

string

setDirectory()

setDirectory(string  $directory) : \App\Util\FileSystem

Parameters

string $directory

Returns

\App\Util\FileSystem

setDiskName()

setDiskName(string  $diskName) : \App\Util\FileSystem

Parameters

string $diskName

Returns

\App\Util\FileSystem