Skip to content

Commit fc88c94

Browse files
authored
added patch, updated readme (#18)
1 parent 186e237 commit fc88c94

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,23 @@ Airtable::updateOrCreate(['name' => 'myName'], ['field' => 'myField']);
9595
Airtable::table('companies')->firstOrCreate(['Company Name' => $team->name]);
9696
```
9797

98+
#### Update
99+
- First argument will be the id
100+
- Second argument is the whole record including the updated fields
101+
102+
**Note:** Update is destructive and clear all unspecified cell values if you did not provide a value for them. use PATCH up update specified fields
103+
104+
``` php
105+
Airtable::table('companies')->update('rec5N7fr8GhDtdNxx', [ 'name' => 'Google', 'country' => 'US']);
106+
```
107+
108+
#### Patch
109+
- First argument will be the id
110+
- Second argument is the field you would like to update
111+
``` php
112+
Airtable::table('companies')->patch('rec5N7fr8GhDtdNxx', ['country' => 'US']);
113+
```
114+
98115
### Testing
99116

100117
``` bash

src/Airtable.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ public function update(string $id, $data)
2626
return $this->api->put($id, $data);
2727
}
2828

29+
public function patch(string $id, $data)
30+
{
31+
return $this->api->patch($id, $data);
32+
}
33+
2934
public function destroy(string $id)
3035
{
3136
return $this->api->delete($id);

0 commit comments

Comments
 (0)