Skip to content

Commit 028bb86

Browse files
author
David Nahodyl
committed
documentation updates
1 parent b9e51c7 commit 028bb86

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,15 +197,38 @@ duplicate
197197
```
198198

199199
#### Examples:
200+
Perform a find for a person named Jaina
200201
```
201-
// A person named Jaina
202202
$person = FM::table('person')->where('nameFirst', 'Jaina')->first();
203203
```
204+
205+
Find the 10 most recent invoices for a customer
204206
```
205-
// 10 most recent invoices
206207
$invoices = FM::layout('invoice')->where('customer_id', $customer->id)->orderByDesc('date')->limit(10)->get();
207208
```
208209

210+
Run a script
211+
```
212+
$result = FM::layout('MyLayoutName')->performScript('MyScriptName');
213+
```
214+
215+
Run a script with JSON data as a parameter
216+
```
217+
$json = json_encode ([
218+
'name' => 'Joe Smith',
219+
'birthday' => '1/1/1970'
220+
'favorite_color' => 'blue'
221+
]);
222+
223+
$result = FM::layout('globals')->performScript('New Contact Request'; $json);
224+
```
225+
226+
Perform a script on a database other than the default database connection
227+
```
228+
$result = FM::connection('MyOtherDatabaseConnectionName')->layout('MyLayoutName')->performScript('MyScriptName');
229+
```
230+
231+
209232
## Relating Native Laravel models to FMModels
210233
It is possible to have relationships between native Laravel Model objects from your MySQL database and FMModels created from your FileMaker database. To do this, you will need to set up both connections in your `database.config` file and then make sure your models are pointing to the right connection by setting the `$connection` propety in your Model and FMModel classes.
211234
```

0 commit comments

Comments
 (0)