class ProviderDocument extends Document implements Arrayable, HasProviderId, JsonSerializable

Traits

Properties

string|null $name from  File
string|null $mime from  File
protected array<string, string>|SerializableClosure $headers from  File
protected array<string, mixed>|SerializableClosure $providerOptions from  File

Methods

static File|null
fromArray(array $data)

Reconstruct a file instance from its array representation.

from  File
static string
value(array $data, string $key, string $type)

Get a required value from the file representation.

from  File
string|null
name()

Get the displayable name of the file.

from  File
as(string|null $name)

Set the displayable name of the file.

from  File
withHeaders(array|Closure $headers)

Specify HTTP headers for the file upload. Closures may only capture serializable values.

from  File
withProviderOptions(array|Closure $options)

Specify provider-specific options for the file upload. Closures may only capture serializable values.

from  File
array
providerOptions(Lab|string $provider)

Get the provider-specific options for the file upload.

from  File
array
headers(Lab|string $provider)

Get the HTTP headers for the file upload.

from  File
string|null
mimeType()

Get the file's MIME type.

from  File
withMimeType(string $mimeType)

Set the file's MIME type.

from  File
string
content()

Reject direct content access for a provider reference.

static Base64Document
fromString(string $content, string|null $mimeType = null)

Create a new document from a string.

from  Document
static Base64Document
fromBase64(string $base64, string|null $mimeType = null)

Create a new document from Base64 data.

from  Document
fromId(string $id)

Create a new provider document using the document with the given ID.

from  Document
static LocalDocument
fromPath(string $path)

Create a new document using the document at the given path.

from  Document
static RemoteDocument
fromUrl(string $url)

Create a new remote document using the document at the given HTTP(S) URL.

from  Document
static StoredDocument
fromStorage(string $path, string|null $disk = null)

Create a new stored document using the document at the given path on the given disk.

from  Document
static Base64Document
fromUpload(UploadedFile $file, string|null $mimeType = null)

Create a new Base64 document using the given file upload.

from  Document
get(Provider|Lab|string|null $provider = null)

Retrieve the file from a given provider.

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

Delete the file on a given provider.

__construct(string $id)

Create a new provider document reference.

string
id()

Get the provider ID for the stored file.

array
toArray()

Get the instance as an array.

array
jsonSerialize()

Get the JSON serializable representation of the instance.

Details

in File at line 29
static File|null fromArray(array $data)

Reconstruct a file instance from its array representation.

Parameters

array $data

Return Value

File|null

in File at line 70
static protected string value(array $data, string $key, string $type)

Get a required value from the file representation.

Parameters

array $data
string $key
string $type

Return Value

string

in File at line 82
string|null name()

Get the displayable name of the file.

Return Value

string|null

in File at line 90
HasName as(string|null $name)

Set the displayable name of the file.

Parameters

string|null $name

Return Value

HasName

in File at line 102
File withHeaders(array|Closure $headers)

Specify HTTP headers for the file upload. Closures may only capture serializable values.

Parameters

array|Closure $headers

Return Value

File

in File at line 116
File withProviderOptions(array|Closure $options)

Specify provider-specific options for the file upload. Closures may only capture serializable values.

Parameters

array|Closure $options

Return Value

File

in File at line 130
array providerOptions(Lab|string $provider)

Get the provider-specific options for the file upload.

Parameters

Lab|string $provider

Return Value

array

in File at line 142
array headers(Lab|string $provider)

Get the HTTP headers for the file upload.

Parameters

Lab|string $provider

Return Value

array

in File at line 152
string|null mimeType()

Get the file's MIME type.

Return Value

string|null

in File at line 160
File withMimeType(string $mimeType)

Set the file's MIME type.

Parameters

string $mimeType

Return Value

File

at line 38
string content()

Reject direct content access for a provider reference.

Return Value

string

Exceptions

InvalidArgumentException

in Document at line 19
static Base64Document fromString(string $content, string|null $mimeType = null)

Create a new document from a string.

Parameters

string $content
string|null $mimeType

Return Value

Base64Document

in Document at line 27
static Base64Document fromBase64(string $base64, string|null $mimeType = null)

Create a new document from Base64 data.

Parameters

string $base64
string|null $mimeType

Return Value

Base64Document

in Document at line 35
static ProviderDocument fromId(string $id)

Create a new provider document using the document with the given ID.

Parameters

string $id

Return Value

ProviderDocument

in Document at line 43
static LocalDocument fromPath(string $path)

Create a new document using the document at the given path.

Parameters

string $path

Return Value

LocalDocument

in Document at line 51
static RemoteDocument fromUrl(string $url)

Create a new remote document using the document at the given HTTP(S) URL.

Parameters

string $url

Return Value

RemoteDocument

in Document at line 59
static StoredDocument fromStorage(string $path, string|null $disk = null)

Create a new stored document using the document at the given path on the given disk.

Parameters

string $path
string|null $disk

Return Value

StoredDocument

in Document at line 67
static Base64Document fromUpload(UploadedFile $file, string|null $mimeType = null)

Create a new Base64 document using the given file upload.

Parameters

UploadedFile $file
string|null $mimeType

Return Value

Base64Document

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

Retrieve the file from a given provider.

Parameters

Provider|Lab|string|null $provider

Return Value

FileResponse

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

Delete the file on a given provider.

Parameters

Provider|Lab|string|null $provider

Return Value

void

at line 21
__construct(string $id)

Create a new provider document reference.

Parameters

string $id

at line 28
string id()

Get the provider ID for the stored file.

Return Value

string

at line 49
array toArray()

Get the instance as an array.

Return Value

array

at line 61
array jsonSerialize()

Get the JSON serializable representation of the instance.

Return Value

array