You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-1Lines changed: 15 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,7 +89,21 @@ Many fields in your FileMaker database will be read-only, such as summaries and
89
89
### Container Fields
90
90
This package supports both reading and writing container field data. Container fields are retrieved from FileMaker as attributes on your model which will contain a URL which can be used to retrieve the file from the container.
91
91
92
-
When setting a container field you should set it as an `Illuminate/HTTP/File` object. These attributes will be written back to your container fields along with any other model updates when the `save()` method is called on your model object.
92
+
#### Writing to container fields
93
+
When setting a container field you should set the value to be an `Illuminate/HTTP/File` or `Illuminate/HTTP/UploadedFile` object. These attributes will be written back to your container fields along with any other model updates when the `save()` method is called on your model object.
94
+
```
95
+
$file = new File(storage_path('app/public/gator.jpg'));
96
+
$newPet->photo = $file;
97
+
$newPet->save();
98
+
```
99
+
100
+
#### Custom filenames when inserting files into containers
101
+
By default, files are inserted into containers using the filename of the file you are inserting. If you wish to set a new filename when the file is inserted into the container you can do so by passing the file and filename together in an array when setting your container.
102
+
```
103
+
$file = new File(storage_path('app/public/gator.jpg'));
104
+
$newPet->photo = [$file, 'fluffy.jpg'];
105
+
$newPet->save();
106
+
```
93
107
94
108
### Renaming and Mapping FileMaker Fields
95
109
Sometimes you might be working with a FileMaker database with inconvenient field names. These fields can be remapped to model attributes by setting the `$fieldMapping` attribute. This should be an array of strings, mapping FileMaker Field Name => New Attribute Name. You can then use these names as regular Eloquent attributes and they will work with the correct fields in FileMaker
0 commit comments