Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save cesarockstar1985/1b1348e0f822169a08dd0361dc71dba9 to your computer and use it in GitHub Desktop.
public function selectSurety($requestData, Quote $quote, BestMatchingSuretyResult $bestMatchingSurety): Quote
{
$data = [
'surety_id' => $requestData['surety_id'] ?? null,
'surety_rate' => $requestData['surety_rate'] ?? null,
'agent_id' => $requestData['agent_id'] ?? null,
'amount' => $requestData['amount'] ?? $quote->bond->bond_amount,
];
$quote = $this->patchEntity($quote, $data);
$suggested = $bestMatchingSurety->found;
$quote->suggested_surety_id = $suggested ? $bestMatchingSurety->best_surety->id : null;
$quote->suggested_surety_rate = $suggested ? $bestMatchingSurety->best_commission : null;
$this->saveOrFail($quote);
return $quote;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment