Skip to content

Commit

Permalink
Observers deleted event + event variable refactors
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelnakamura committed Jun 6, 2022
1 parent d1eb74f commit 812bd4d
Show file tree
Hide file tree
Showing 25 changed files with 125 additions and 125 deletions.
16 changes: 8 additions & 8 deletions src/Observers/Customer/BankAccountObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@

class BankAccountObserver
{
public function created($customer)
public function created($bankAccount)
{
if (!Config::get('iss-supernova.base_uri')) {
return;
}

$customer->loadMissing(
$bankAccount->loadMissing(
'customer',
'bank',
);
$data = $customer->toArray();
$data = $bankAccount->toArray();
$data['sync_to'] = 'sys';

try {
Expand All @@ -32,17 +32,17 @@ public function created($customer)
}
}

public function updated($customer)
public function updated($bankAccount)
{
if (!Config::get('iss-supernova.base_uri')) {
return;
}

$customer->loadMissing(
$bankAccount->loadMissing(
'customer',
'bank',
);
$data = $customer->toArray();
$data = $bankAccount->toArray();
$data['sync_to'] = 'sys';

try {
Expand All @@ -55,8 +55,8 @@ public function updated($customer)
}
}

public function deleted($customer)
public function deleted($bankAccount)
{
//
$this->updated($bankAccount);
}
}
16 changes: 8 additions & 8 deletions src/Observers/Customer/CreditCardObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@

class CreditCardObserver
{
public function created($customer)
public function created($creditCard)
{
if (!Config::get('iss-supernova.base_uri')) {
return;
}

$customer->loadMissing(
$creditCard->loadMissing(
'customer',
'credit_card_flag',
);
$data = $customer->toArray();
$data = $creditCard->toArray();
$data['sync_to'] = 'sys';

try {
Expand All @@ -32,17 +32,17 @@ public function created($customer)
}
}

public function updated($customer)
public function updated($creditCard)
{
if (!Config::get('iss-supernova.base_uri')) {
return;
}

$customer->loadMissing(
$creditCard->loadMissing(
'customer',
'credit_card_flag',
);
$data = $customer->toArray();
$data = $creditCard->toArray();
$data['sync_to'] = 'sys';

try {
Expand All @@ -55,8 +55,8 @@ public function updated($customer)
}
}

public function deleted($customer)
public function deleted($creditCard)
{
//
$this->updated($creditCard);
}
}
2 changes: 1 addition & 1 deletion src/Observers/Customer/CustomerObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,6 @@ public function updated($customer)

public function deleted($customer)
{
//
$this->updated($customer);
}
}
16 changes: 8 additions & 8 deletions src/Observers/Customer/DependentObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@

class DependentObserver
{
public function created($customer)
public function created($dependent)
{
if (!Config::get('iss-supernova.base_uri')) {
return;
}

$customer->loadMissing(
$dependent->loadMissing(
'customer',
'dependent_type',
'educational_institution',
'educational_course',
);
$data = $customer->toArray();
$data = $dependent->toArray();
$data['sync_to'] = 'sys';

try {
Expand All @@ -34,19 +34,19 @@ public function created($customer)
}
}

public function updated($customer)
public function updated($dependent)
{
if (!Config::get('iss-supernova.base_uri')) {
return;
}

$customer->loadMissing(
$dependent->loadMissing(
'customer',
'dependent_type',
'educational_institution',
'educational_course',
);
$data = $customer->toArray();
$data = $dependent->toArray();
$data['sync_to'] = 'sys';

try {
Expand All @@ -59,8 +59,8 @@ public function updated($customer)
}
}

public function deleted($customer)
public function deleted($dependent)
{
//
$this->updated($dependent);
}
}
20 changes: 10 additions & 10 deletions src/Observers/Customer/DocumentObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@

class DocumentObserver
{
public function created($customer)
public function created($document)
{
if (!Config::get('iss-supernova.base_uri')) {
return;
}

$customer->loadMissing(
$document->loadMissing(
'customer',
'document_type',
);
$data = $customer->toArray();
$data = $document->toArray();
$data['sync_to'] = 'sys';

//Passo o campo file novamente pois Document::getFileAttribute() gera uma url temporária de 5 minutos do S3
$data['file'] = $customer->getAttributes()['file'];
$data['file'] = $document->getAttributes()['file'];

try {
$issSupernova = new IssSupernova();
Expand All @@ -35,21 +35,21 @@ public function created($customer)
}
}

public function updated($customer)
public function updated($document)
{
if (!Config::get('iss-supernova.base_uri')) {
return;
}

$customer->loadMissing(
$document->loadMissing(
'customer',
'document_type',
);
$data = $customer->toArray();
$data = $document->toArray();
$data['sync_to'] = 'sys';

//Passo o campo file novamente pois Document::getFileAttribute() gera uma url temporária de 5 minutos do S3
$data['file'] = $customer->getAttributes()['file'];
$data['file'] = $document->getAttributes()['file'];

try {
$issSupernova = new IssSupernova();
Expand All @@ -61,8 +61,8 @@ public function updated($customer)
}
}

public function deleted($customer)
public function deleted($document)
{
//
$this->updated($document);
}
}
16 changes: 8 additions & 8 deletions src/Observers/Customer/FgtsAccountObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@

class FgtsAccountObserver
{
public function created($customer)
public function created($fgtsAccount)
{
if (!Config::get('iss-supernova.base_uri')) {
return;
}

$customer->loadMissing(
$fgtsAccount->loadMissing(
'customer',
);
$data = $customer->toArray();
$data = $fgtsAccount->toArray();
$data['sync_to'] = 'sys';

try {
Expand All @@ -31,16 +31,16 @@ public function created($customer)
}
}

public function updated($customer)
public function updated($fgtsAccount)
{
if (!Config::get('iss-supernova.base_uri')) {
return;
}

$customer->loadMissing(
$fgtsAccount->loadMissing(
'customer',
);
$data = $customer->toArray();
$data = $fgtsAccount->toArray();
$data['sync_to'] = 'sys';

try {
Expand All @@ -53,8 +53,8 @@ public function updated($customer)
}
}

public function deleted($customer)
public function deleted($fgtsAccount)
{
//
$this->updated($fgtsAccount);
}
}
16 changes: 8 additions & 8 deletions src/Observers/Customer/FinancialCommitmentObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@

class FinancialCommitmentObserver
{
public function created($customer)
public function created($financialCommitment)
{
if (!Config::get('iss-supernova.base_uri')) {
return;
}

$customer->loadMissing(
$financialCommitment->loadMissing(
'customer',
'financial_commitment',
);
$data = $customer->toArray();
$data = $financialCommitment->toArray();
$data['sync_to'] = 'sys';

try {
Expand All @@ -32,17 +32,17 @@ public function created($customer)
}
}

public function updated($customer)
public function updated($financialCommitment)
{
if (!Config::get('iss-supernova.base_uri')) {
return;
}

$customer->loadMissing(
$financialCommitment->loadMissing(
'customer',
'financial_commitment',
);
$data = $customer->toArray();
$data = $financialCommitment->toArray();
$data['sync_to'] = 'sys';

try {
Expand All @@ -55,8 +55,8 @@ public function updated($customer)
}
}

public function deleted($customer)
public function deleted($financialCommitment)
{
//
$this->updated($financialCommitment);
}
}
16 changes: 8 additions & 8 deletions src/Observers/Customer/FormalIncomeObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@

class FormalIncomeObserver
{
public function created($customer)
public function created($formalIncome)
{
if (!Config::get('iss-supernova.base_uri')) {
return;
}

$customer->loadMissing(
$formalIncome->loadMissing(
'customer',
'occupation',
'proof_of_income_type',
);
$data = $customer->toArray();
$data = $formalIncome->toArray();
$data['sync_to'] = 'sys';

try {
Expand All @@ -33,18 +33,18 @@ public function created($customer)
}
}

public function updated($customer)
public function updated($formalIncome)
{
if (!Config::get('iss-supernova.base_uri')) {
return;
}

$customer->loadMissing(
$formalIncome->loadMissing(
'customer',
'occupation',
'proof_of_income_type',
);
$data = $customer->toArray();
$data = $formalIncome->toArray();
$data['sync_to'] = 'sys';

try {
Expand All @@ -57,8 +57,8 @@ public function updated($customer)
}
}

public function deleted($customer)
public function deleted($formalIncome)
{
//
$this->updated($formalIncome);
}
}
Loading

0 comments on commit 812bd4d

Please sign in to comment.