1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Add CompanyGatewayObserverg

This commit is contained in:
= 2020-08-22 10:42:12 +10:00
parent 8bfb778d86
commit 279609f70f
2 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,66 @@
<?php
namespace App\Observers;
use App\CompanyGateway;
class CompanyGatewayObserver
{
/**
* Handle the company gateway "created" event.
*
* @param \App\CompanyGateway $company_gateway
* @return void
*/
public function created(CompanyGateway $company_gateway)
{
if(!$company_gateway->label){
$company_gateway->label = $company_gateway->gateway->name;
$company_gateway->save();
}
}
/**
* Handle the company gateway "updated" event.
*
* @param \App\CompanyGateway $company_gateway
* @return void
*/
public function updated(CompanyGateway $company_gateway)
{
//
}
/**
* Handle the company gateway "deleted" event.
*
* @param \App\CompanyGateway $company_gateway
* @return void
*/
public function deleted(CompanyGateway $company_gateway)
{
//
}
/**
* Handle the company gateway "restored" event.
*
* @param \App\CompanyGateway $company_gateway
* @return void
*/
public function restored(CompanyGateway $company_gateway)
{
//
}
/**
* Handle the company gateway "force deleted" event.
*
* @param \App\CompanyGateway $company_gateway
* @return void
*/
public function forceDeleted(CompanyGateway $company_gateway)
{
//
}
}

View File

@ -15,6 +15,7 @@ use App\Helpers\Language\DecoratedTranslator;
use App\Models\Account;
use App\Models\Client;
use App\Models\Company;
use App\Models\CompanyGateway;
use App\Models\CompanyToken;
use App\Models\Expense;
use App\Models\Invoice;
@ -26,6 +27,7 @@ use App\Models\Task;
use App\Models\User;
use App\Observers\AccountObserver;
use App\Observers\ClientObserver;
use App\Observers\CompanyGatewayObserver;
use App\Observers\CompanyObserver;
use App\Observers\CompanyTokenObserver;
use App\Observers\ExpenseObserver;
@ -68,6 +70,7 @@ class AppServiceProvider extends ServiceProvider
Account::observe(AccountObserver::class);
Client::observe(ClientObserver::class);
Company::observe(CompanyObserver::class);
CompanyGateway::observe(CompanyGatewayObserver::class);
CompanyToken::observe(CompanyTokenObserver::class);
Expense::observe(ExpenseObserver::class);
Invoice::observe(InvoiceObserver::class);