feat: updates
This commit is contained in:
87
app/Observers/ClientObserver.php
Normal file
87
app/Observers/ClientObserver.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace App\Observers;
|
||||
|
||||
use App\Models\Client;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class ClientObserver
|
||||
{
|
||||
/**
|
||||
* Handle the Client "created" event.
|
||||
*/
|
||||
public function created(Client $client): void
|
||||
{
|
||||
DB::transaction(function () use ($client) {
|
||||
$client->accounts()->createMany([
|
||||
[
|
||||
'account_type_id' => 1,
|
||||
'account' => 'Cash',
|
||||
'normal_balance' => 'debit',
|
||||
],
|
||||
[
|
||||
'account_type_id' => 1,
|
||||
'account' => 'Input Tax',
|
||||
'normal_balance' => 'debit',
|
||||
],
|
||||
[
|
||||
'account_type_id' => 1,
|
||||
'account' => 'Creditable Withholding Tax',
|
||||
'normal_balance' => 'debit',
|
||||
],
|
||||
[
|
||||
'account_type_id' => 2,
|
||||
'account' => 'Output Tax',
|
||||
'normal_balance' => 'credit',
|
||||
],
|
||||
[
|
||||
'account_type_id' => 2,
|
||||
'account' => 'Payable Withholding Tax',
|
||||
'normal_balance' => 'credit',
|
||||
],
|
||||
[
|
||||
'account_type_id' => 5,
|
||||
'account' => 'Vat Exempt Revenue',
|
||||
'normal_balance' => 'credit',
|
||||
],
|
||||
[
|
||||
'account_type_id' => 4,
|
||||
'account' => 'Sales Discount',
|
||||
'normal_balance' => 'debit',
|
||||
],
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Client "updated" event.
|
||||
*/
|
||||
public function updated(Client $client): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Client "deleted" event.
|
||||
*/
|
||||
public function deleted(Client $client): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Client "restored" event.
|
||||
*/
|
||||
public function restored(Client $client): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the Client "force deleted" event.
|
||||
*/
|
||||
public function forceDeleted(Client $client): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user