Skip to content

Commit

Permalink
Merge pull request #100 from danielpetrica/master
Browse files Browse the repository at this point in the history
Edit model to handle custom headers
  • Loading branch information
roblesterjr04 authored Oct 24, 2023
2 parents 898262d + 259d94e commit 84450db
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ abstract class Model extends EloquentModel
'LastModifiedDate',
];

public $custom_headers = [];

//public $timestamps = false;

/**
Expand Down Expand Up @@ -217,9 +219,13 @@ protected function performUpdate($query)
SObjects::authenticate();
$object = $this->sfObject();

// The user can set this property on it's models to set some custom value for the headers
$headers = $this->custom_headers ?: null;

$result = SObjects::sobjects($object, [
'method' => 'patch',
'body' => $dirty->toArray(),
'headers' => $headers
]);

SObjects::queryHistory()->push(['update' => $dirty->toArray()]);
Expand Down

0 comments on commit 84450db

Please sign in to comment.