LocalDocument
class LocalDocument extends Document implements Arrayable, JsonSerializable, StorableFile
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
Reconstruct a file instance from its array representation.
Get a required value from the file representation.
Specify HTTP headers for the file upload. Closures may only capture serializable values.
Specify provider-specific options for the file upload. Closures may only capture serializable values.
Get the provider-specific options for the file upload.
Create a new document from a string.
Create a new document from Base64 data.
Create a new provider document using the document with the given ID.
Create a new document using the document at the given path.
Create a new remote document using the document at the given HTTP(S) URL.
Create a new stored document using the document at the given path on the given disk.
Create a new Base64 document using the given file upload.
Get the JSON serializable representation of the instance.
Create a new local document.
Create a document from an uploaded file, holding the upload so its temporary file is not discarded.
Get the instance as an array.
Get the serializable representation of the document.
Restore the document from its serialized representation.
Details
in
File at line 29
static File|null
fromArray(array $data)
Reconstruct a file instance from its array representation.
in
File at line 70
static protected string
value(array $data, string $key, string $type)
Get a required value from the file representation.
in
HasLocalContent at line 31
string|null
name()
Get the displayable name of the file.
in
File at line 102
File
withHeaders(array|Closure $headers)
Specify HTTP headers for the file upload. Closures may only capture serializable values.
in
File at line 116
File
withProviderOptions(array|Closure $options)
Specify provider-specific options for the file upload. Closures may only capture serializable values.
in
File at line 130
array
providerOptions(Lab|string $provider)
Get the provider-specific options for the file upload.
in
File at line 142
array
headers(Lab|string $provider)
Get the HTTP headers for the file upload.
in
HasLocalContent at line 39
string|null
mimeType()
Get the file's MIME type.
in
HasLocalContent at line 17
string
content()
Get the raw representation of the file.
in
Document at line 19
static Base64Document
fromString(string $content, string|null $mimeType = null)
Create a new document from a string.
in
Document at line 27
static Base64Document
fromBase64(string $base64, string|null $mimeType = null)
Create a new document from Base64 data.
in
Document at line 35
static ProviderDocument
fromId(string $id)
Create a new provider document using the document with the given ID.
in
Document at line 43
static LocalDocument
fromPath(string $path)
Create a new document using the document at the given path.
in
Document at line 51
static RemoteDocument
fromUrl(string $url)
Create a new remote document using the document at the given HTTP(S) URL.
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.
in
Document at line 67
static Base64Document
fromUpload(UploadedFile $file, string|null $mimeType = null)
Create a new Base64 document using the given file upload.
in
CanBeUploadedToProvider at line 17
StoredFileResponse
put(string|null $mimeType = null, string|null $name = null, Provider|Lab|string|null $provider = null)
Store the file on a given provider.
in
HasLocalContent at line 47
array
jsonSerialize()
Get the JSON serializable representation of the instance.
in
HasLocalContent at line 55
string
__toString()
Get the file content as a string.
at line 23
__construct(string $path, string|null $mimeType = null, UploadedFile|null $upload = null)
Create a new local document.
at line 35
static LocalDocument
fromUploadedFile(UploadedFile $file)
Create a document from an uploaded file, holding the upload so its temporary file is not discarded.
at line 47
array
toArray()
Get the instance as an array.
at line 62
array
__serialize()
Get the serializable representation of the document.
at line 76
void
__unserialize(array $data)
Restore the document from its serialized representation.