class Files

Methods

static FileResponse
get(string $fileId, Provider|Lab|string|null $provider = null)

Get a file by its ID.

put(StorableFile|UploadedFile|string $file, string|null $mimeType = null, string|null $name = null, Provider|Lab|string|null $provider = null)

Store the given file.

putFromPath(string $path, string|null $mimeType = null, string|null $name = null, Provider|Lab|string|null $provider = null)

Store the file at the given local path.

putFromStorage(string $path, string|null $disk = null, string|null $name = null, Provider|Lab|string|null $provider = null)

Store the file at the given path on the given disk.

static void
delete(string $fileId, Provider|Lab|string|null $provider = null)

Delete a file by its ID.

static FakeFileGateway
fake(Closure|array $responses = [])

Fake file operations.

static string
fakeId(string $for)

Get the fake file ID for a given name or content.

static void
assertStored(Closure $callback)

Assert that a file was stored matching a given truth test.

static void
assertNotStored(Closure $callback)

Assert that a file was not stored matching a given truth test.

static void
assertNothingStored()

Assert that no files were stored.

static void
assertDeleted(Closure|string $callback)

Assert that a file was deleted matching a given truth test.

static void
assertNotDeleted(Closure|string $callback)

Assert that a file was not deleted matching a given truth test.

static void
assertNothingDeleted()

Assert that no files were deleted.

static bool
isFaked()

Determine if file operations are faked.

Details

at line 25
static FileResponse get(string $fileId, Provider|Lab|string|null $provider = null)

Get a file by its ID.

Parameters

string $fileId
Provider|Lab|string|null $provider

Return Value

FileResponse

at line 33
static StoredFileResponse put(StorableFile|UploadedFile|string $file, string|null $mimeType = null, string|null $name = null, Provider|Lab|string|null $provider = null)

Store the given file.

Parameters

StorableFile|UploadedFile|string $file
string|null $mimeType
string|null $name
Provider|Lab|string|null $provider

Return Value

StoredFileResponse

at line 59
static StoredFileResponse putFromPath(string $path, string|null $mimeType = null, string|null $name = null, Provider|Lab|string|null $provider = null)

Store the file at the given local path.

Parameters

string $path
string|null $mimeType
string|null $name
Provider|Lab|string|null $provider

Return Value

StoredFileResponse

at line 67
static StoredFileResponse putFromStorage(string $path, string|null $disk = null, string|null $name = null, Provider|Lab|string|null $provider = null)

Store the file at the given path on the given disk.

Parameters

string $path
string|null $disk
string|null $name
Provider|Lab|string|null $provider

Return Value

StoredFileResponse

at line 75
static void delete(string $fileId, Provider|Lab|string|null $provider = null)

Delete a file by its ID.

Parameters

string $fileId
Provider|Lab|string|null $provider

Return Value

void

at line 85
static FakeFileGateway fake(Closure|array $responses = [])

Fake file operations.

The fake gateway is shared across requests in the worker.

Parameters

Closure|array $responses

Return Value

FakeFileGateway

at line 94
static string fakeId(string $for)

Get the fake file ID for a given name or content.

Parameters

string $for

Return Value

string

at line 102
static void assertStored(Closure $callback)

Assert that a file was stored matching a given truth test.

Parameters

Closure $callback

Return Value

void

at line 110
static void assertNotStored(Closure $callback)

Assert that a file was not stored matching a given truth test.

Parameters

Closure $callback

Return Value

void

at line 118
static void assertNothingStored()

Assert that no files were stored.

Return Value

void

at line 126
static void assertDeleted(Closure|string $callback)

Assert that a file was deleted matching a given truth test.

Parameters

Closure|string $callback

Return Value

void

at line 134
static void assertNotDeleted(Closure|string $callback)

Assert that a file was not deleted matching a given truth test.

Parameters

Closure|string $callback

Return Value

void

at line 142
static void assertNothingDeleted()

Assert that no files were deleted.

Return Value

void

at line 150
static bool isFaked()

Determine if file operations are faked.

Return Value

bool