feat: updates

This commit is contained in:
JP
2024-08-11 20:03:49 +08:00
parent 140e821e0c
commit 52431a2c61
45 changed files with 1152 additions and 287 deletions

View 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
{
//
}
}