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
With the package installed you can now have access to all the features of this package. There are a few different areas to configure.
42
42
43
43
## Database configuration
44
-
The first thing to do is to add a new data connection in your ```database.php``` config file. The connections you specify here will be used in your FMModel classes to configure which databases each model will connect to.
44
+
The first thing to do is to add a new data connection in your `database.php` config file. The connections you specify here will be used in your FMModel classes to configure which databases each model will connect to.
45
45
46
46
You may use the following code block below as a template.
47
-
48
-
'filemaker' => [
49
-
'driver' => 'filemaker',
50
-
'host' => env('DB_HOST', 'fms.mycompany.com'),
51
-
'database' => env('DB_DATABASE', 'MyFileName'),
52
-
'username' => env('DB_USERNAME', 'myusername'),
53
-
'password' => env('DB_PASSWORD', ''),
54
-
'prefix' => env('DB_PREFIX', ''),
55
-
'version' => env('DB_VERSION', 'vLatest'),
56
-
'protocol' => env('DB_PROTOCOL', 'https'),
57
-
]
58
-
47
+
```php
48
+
'filemaker' => [
49
+
'driver' => 'filemaker',
50
+
'host' => env('DB_HOST', 'fms.mycompany.com'),
51
+
'database' => env('DB_DATABASE', 'MyFileName'),
52
+
'username' => env('DB_USERNAME', 'myusername'),
53
+
'password' => env('DB_PASSWORD', ''),
54
+
'prefix' => env('DB_PREFIX', ''),
55
+
'version' => env('DB_VERSION', 'vLatest'),
56
+
'protocol' => env('DB_PROTOCOL', 'https'),
57
+
]
58
+
```
59
59
You should add one database connection configuration for each FileMaker database you will be connecting to. Each file can have completely different configurations, and can even be on different servers.
60
60
61
61
Sessions will be maintained on a per-connection basis and tokens will automatically be cached using whatever cache configuration you have set up for your Laravel app.
@@ -100,17 +100,17 @@ This package supports both reading and writing container field data. Container f
100
100
#### Writing to container fields
101
101
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.
102
102
```php
103
-
$file = new File(storage_path('app/public/gator.jpg'));
104
-
$newPet->photo = $file;
105
-
$newPet->save();
103
+
$file = new File(storage_path('app/public/gator.jpg'));
104
+
$newPet->photo = $file;
105
+
$newPet->save();
106
106
```
107
107
108
108
#### Custom filenames when inserting files into containers
109
109
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.
110
110
```php
111
-
$file = new File(storage_path('app/public/gator.jpg'));
112
-
$newPet->photo = [$file, 'fluffy.jpg'];
113
-
$newPet->save();
111
+
$file = new File(storage_path('app/public/gator.jpg'));
This package has special handling for casting FileMaker Timestamp and Date fields to Carbon instances for you. To take advantage of this, you must map the fields as you would with a native Laravel Model class. You can use the `$casts` property as you normally would for these attributes.
170
170
171
171
```php
172
-
protected $casts = [
173
-
'nextAppointment' => 'datetime',
174
-
'birthday' => 'date',
175
-
];
172
+
protected $casts = [
173
+
'nextAppointment' => 'datetime',
174
+
'birthday' => 'date',
175
+
];
176
176
```
177
177
178
178
The format Date and Timestamp fields written to FileMaker can be changed via the `$dateFormat` property of your model. This value must be compatible with the format output from the FileMaker Data API for Timestamp values and will be the format written back into your database. One important requirement is that this must be a full timestamp format, not just a date format.
0 commit comments