Update pampasan module with enhanced agreement tracking and semporna processing
- Add agreement_printed_at timestamp to pampasan table for tracking printed agreements - Update jenis handling for semporna v2 processing logic - Refactor barangkes controller eager loading for improved performance - Remove obsolete jenis migration files and consolidate schema changes - Update related models and controllers for semporna v2 compatibility
This commit is contained in:
@@ -38,13 +38,10 @@ class BarangkesController extends Controller
|
||||
'untungonepercent',
|
||||
'untungcajlain'
|
||||
])
|
||||
->when($request->filled('jenis'), function($query) use($request){
|
||||
return $query->where('jenis', $request->jenis);
|
||||
})
|
||||
->when($request->filled('tarikh_mula') && $request->filled('tarikh_akhir'), function($query) use($request){
|
||||
return $query->whereBetween('tarikh', [$request->tarikh_mula, $request->tarikh_akhir]);
|
||||
})
|
||||
->with('tebus:norujukan');
|
||||
->with(['tebus:norujukan', 'gadai:norujukan,nokp']);
|
||||
|
||||
$palsu_array = $palsu_query->get()->toArray();
|
||||
$pampasan_array = Pampasan::on($cawangan['mysql'])->where('kodcaw', $request->kodcaw)->get()->toArray();
|
||||
@@ -59,8 +56,13 @@ class BarangkesController extends Controller
|
||||
// Add exists_in_tebus flag based on relationship
|
||||
$itemArray['gadaian_sudah_tebus'] = !is_null($item['tebus']);
|
||||
|
||||
// Add nokp customer from gadai relationship
|
||||
$itemArray['nokp'] = $item['gadai']['nokp'];
|
||||
|
||||
// Remove the tebus relationship data to keep response clean
|
||||
unset($itemArray['tebus']);
|
||||
unset($itemArray['gadai']);
|
||||
|
||||
|
||||
return array_merge($itemArray, $additional);
|
||||
})->values()->toArray();
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Cawangan;
|
||||
use App\Palsu;
|
||||
use App\Pampasan;
|
||||
use App\Panjar;
|
||||
use App\Tebus;
|
||||
use Illuminate\Http\Request;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Log\Logger;
|
||||
@@ -13,46 +14,37 @@ use Illuminate\Support\Facades\Log;
|
||||
|
||||
class PampasanController extends Controller
|
||||
{
|
||||
|
||||
public function terimaPampasan(Request $request)
|
||||
{
|
||||
$validated = $this->validate($request, [
|
||||
'norujukan' => 'required|string',
|
||||
'baucerno' => 'required|string',
|
||||
'kodcaw' => 'required|string',
|
||||
'jumlah_pampasan' => 'required|numeric',
|
||||
'denominasi' => 'nullable|array',
|
||||
'denominasi' => 'required|array',
|
||||
'teller' => 'required|string',
|
||||
]);
|
||||
|
||||
try {
|
||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw', $request->kodcaw)->first();
|
||||
$cawangan = $this->getCawangan($request->kodcaw);
|
||||
|
||||
if (!$cawangan) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Cawangan tidak dijumpai untuk kodcaw: ' . $request->kodcaw,
|
||||
], 404);
|
||||
return $this->errorResponse('Cawangan tidak dijumpai untuk kodcaw: ' . $request->kodcaw, 404);
|
||||
}
|
||||
|
||||
$pampasan = Pampasan::on($cawangan['mysql'])->create([
|
||||
'norujukan' => $validated['norujukan'],
|
||||
'baucerno' => $validated['baucerno'],
|
||||
'kodcaw' => $validated['kodcaw'],
|
||||
$pampasan = Pampasan::on($cawangan['mysql'])
|
||||
->where('norujukan', $validated['norujukan'])
|
||||
->first();
|
||||
|
||||
$pampasan->update([
|
||||
'jumlah_pampasan' => $validated['jumlah_pampasan'],
|
||||
'denominasi' => isset($validated['denominasi']) ? json_encode($validated['denominasi']) : null,
|
||||
'teller' => $validated['teller'],
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Pampasan berjaya dibayar.',
|
||||
'data' => $pampasan,
|
||||
], 201);
|
||||
return $this->successResponse('Pampasan berjaya dibayar.', $pampasan, 201);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Database error: ' . $e->getMessage(),
|
||||
], 500);
|
||||
return $this->errorResponse('Database error: ' . $e->getMessage(), 500);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +52,13 @@ class PampasanController extends Controller
|
||||
{
|
||||
$norujukan = $request->norujukan;
|
||||
|
||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw', $request->kodcaw)->first();
|
||||
$cawangan = $this->getCawangan($request->kodcaw);
|
||||
|
||||
if (!$cawangan) {
|
||||
return $this->errorResponse('Cawangan tidak dijumpai untuk kodcaw: ' . $request->kodcaw, 404);
|
||||
}
|
||||
|
||||
$tebus = Tebus::on($cawangan['mysql'])->where('norujukan', $norujukan)->first();
|
||||
|
||||
$pampasan = Pampasan::on($cawangan['mysql'])->where("norujukan", $norujukan)->first();
|
||||
|
||||
@@ -73,40 +71,128 @@ class PampasanController extends Controller
|
||||
->where('norujukan', $norujukan)
|
||||
->update(['status' => 1]);
|
||||
|
||||
Panjar::on($cawangan['mysql'])
|
||||
->create([
|
||||
'tarikh' => Carbon::now()->toDateString(),
|
||||
'deskripsi' => 'BAYARAN PAMPASAN' . '(' . $pampasan->norujukan . ')',
|
||||
'bayaran' => $pampasan->jumlah_pampasan,
|
||||
'tag' => 1,
|
||||
'kategori' => 'Belanja AM',
|
||||
'id' => $pampasan->teller,
|
||||
'bakiperubatan' => $request->bakiperubatan,
|
||||
'nobaucer' => $pampasan->baucherno,
|
||||
'nobil' => Carbon::now()->format('dmy'),
|
||||
'tuntutoleh' => $pampasan->teller,
|
||||
return $this->successResponse('Status Pampasan berjaya dituntut.', $pampasan, 201);
|
||||
}
|
||||
|
||||
public function getPampasan(Request $request)
|
||||
{
|
||||
$cawangan_connection = Cawangan::where('kodcaw', $request->kodcaw)->first()->mysql;
|
||||
|
||||
$pampasan = Pampasan::on($cawangan_connection)
|
||||
->when($request->filled('norujukan'), function ($query) use ($request) {
|
||||
return $query->where('norujukan', $request->norujukan);
|
||||
})
|
||||
->get();
|
||||
|
||||
|
||||
return $this->successResponse('Senarai pampasan', $pampasan, 201);
|
||||
}
|
||||
|
||||
public function updateAgreementPrintedAt(Request $request)
|
||||
{
|
||||
$validated = $this->validate($request, [
|
||||
'norujukan' => 'required|string',
|
||||
'kodcaw' => 'required|string',
|
||||
]);
|
||||
|
||||
try {
|
||||
$cawangan = $this->getCawangan($validated['kodcaw']);
|
||||
|
||||
if (!$cawangan) {
|
||||
return $this->errorResponse('Cawangan tidak dijumpai untuk kodcaw: ' . $validated['kodcaw'], 404);
|
||||
}
|
||||
|
||||
$pampasan = Pampasan::on($cawangan['mysql'])->where('norujukan', $validated['norujukan'])->first();
|
||||
|
||||
if (!$pampasan) {
|
||||
return $this->errorResponse('Pampasan tidak dijumpai untuk norujukan: ' . $validated['norujukan'], 404);
|
||||
}
|
||||
|
||||
$pampasan->agreement_printed_at = Carbon::now();
|
||||
$pampasan->save();
|
||||
|
||||
return $this->successResponse('Agreement printed timestamp berjaya dikemaskini.', $pampasan, 200);
|
||||
} catch (\Exception $e) {
|
||||
return $this->errorResponse('Database error: ' . $e->getMessage(), 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function initiatePampasan(Request $request)
|
||||
{
|
||||
$validated = $this->validate($request, [
|
||||
'norujukan' => 'required|string',
|
||||
'kodcaw' => 'required|string',
|
||||
'teller' => 'required|string',
|
||||
'baucerno' => 'required|string',
|
||||
]);
|
||||
|
||||
try {
|
||||
$cawangan = $this->getCawangan($validated['kodcaw']);
|
||||
|
||||
if (!$cawangan) {
|
||||
return $this->errorResponse('Cawangan tidak dijumpai untuk kodcaw: ' . $validated['kodcaw'], 404);
|
||||
}
|
||||
|
||||
// Find the palsu record
|
||||
$palsu = Palsu::on($cawangan['mysql'])->where('norujukan', $validated['norujukan'])->first();
|
||||
|
||||
if (!$palsu) {
|
||||
return $this->errorResponse('Barang kes tidak dijumpai untuk norujukan: ' . $validated['norujukan'], 404);
|
||||
}
|
||||
|
||||
// Check if pampasan already exists for this norujukan
|
||||
$existingPampasan = Pampasan::on($cawangan['mysql'])->where('norujukan', $validated['norujukan'])->first();
|
||||
|
||||
if ($existingPampasan) {
|
||||
// If pampasan exists, just update the agreement_printed_at
|
||||
$existingPampasan->agreement_printed_at = Carbon::now();
|
||||
$existingPampasan->save();
|
||||
|
||||
return $this->successResponse('Agreement printed timestamp berjaya dikemaskini untuk pampasan sedia ada.', $existingPampasan, 200);
|
||||
}
|
||||
|
||||
// Create new pampasan record based on palsu data
|
||||
$pampasan = Pampasan::on($cawangan['mysql'])->create([
|
||||
'norujukan' => $palsu->norujukan,
|
||||
'baucerno' => $validated['baucerno'],
|
||||
'kodcaw' => $palsu->kodcaw,
|
||||
'jumlah_pampasan' => $palsu->nilaimarhun,
|
||||
'teller' => $validated['teller'],
|
||||
'status' => 0,
|
||||
'agreement_printed_at' => Carbon::now(),
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Status Pampasan berjaya dituntut.',
|
||||
'data' => $pampasan,
|
||||
], 201);
|
||||
return $this->successResponse('Pampasan berjaya daftar dari rekod barang kes.', $pampasan, 201);
|
||||
} catch (\Exception $e) {
|
||||
return $this->errorResponse('Database error: ' . $e->getMessage(), 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function getPampasan()
|
||||
private function getCawangan($kodcaw)
|
||||
{
|
||||
$pampasan = Pampasan::on('mysql71')->get();
|
||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw', $kodcaw)->first();
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Status Pampasan berjaya dituntut.',
|
||||
'data' => $pampasan,
|
||||
], 201);
|
||||
if (!$cawangan) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $cawangan;
|
||||
}
|
||||
|
||||
public function getPampasanByNoRujukan()
|
||||
private function errorResponse($message, $statusCode = 404)
|
||||
{
|
||||
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => $message,
|
||||
], $statusCode);
|
||||
}
|
||||
|
||||
private function successResponse($message, $data = null, $statusCode = 200)
|
||||
{
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => $message,
|
||||
'data' => $data,
|
||||
], $statusCode);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-1
@@ -31,7 +31,6 @@ class Palsu extends Model
|
||||
'untungonepercent',
|
||||
'untungcajlain',
|
||||
'pembiayaan',
|
||||
'jenis',
|
||||
'status',
|
||||
];
|
||||
|
||||
@@ -95,4 +94,9 @@ class Palsu extends Model
|
||||
{
|
||||
return $this->hasOne(Tebus::class, 'norujukan', 'norujukan');
|
||||
}
|
||||
|
||||
public function gadai(): HasOne
|
||||
{
|
||||
return $this->hasOne(Gadai::class, 'norujukan', 'norujukan');
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -20,8 +20,10 @@ class Pampasan extends Model
|
||||
'baucerno',
|
||||
'kodcaw',
|
||||
'jumlah_pampasan',
|
||||
'denominasi',
|
||||
'teller',
|
||||
'nota'
|
||||
'nota',
|
||||
'agreement_printed_at',
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,11 +2,14 @@
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
use App\Cawangan;
|
||||
use App\KadarUpah;
|
||||
use App\Pampasan;
|
||||
use App\Support\v1\GadaiV1 as Version1Gadai;
|
||||
|
||||
use App\Services\MasterServices;
|
||||
use App\Support\v1\Penebusan;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request as HttpRequest;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@ use App\KomuditiPurchase;
|
||||
use App\KomuditiTransaksi;
|
||||
use App\Marhun;
|
||||
use App\Moratorium;
|
||||
use App\Palsu;
|
||||
use App\Pampasan;
|
||||
use App\Support\OnePercent;
|
||||
use App\Support\Tawarruq;
|
||||
use App\Support\v1\Calculation as V1Calculation;
|
||||
@@ -479,6 +481,17 @@ class Penebusan
|
||||
$upah_rebet_sebenar = $harga_tebus - $gadai['bakipjm'];
|
||||
}
|
||||
|
||||
$isPampasan = Pampasan::on($cawangan['mysql'])->where('norujukan', $request->norujukan)->exists();
|
||||
|
||||
if($isPampasan){
|
||||
$barang_kes = Palsu::on($cawangan['mysql'])->where('norujukan', $norujukan)->first();
|
||||
|
||||
$harga_tebus = $barang_kes->untung + $barang_kes->pembiayaan;
|
||||
$upah_tebus = $barang_kes->untung;
|
||||
$upah_rebet = $this->kiraUpahRebetSebenar($kodcaw,$norujukan);
|
||||
$upah_rebet_sebenar = $barang_kes->untung;
|
||||
$rebet = $gadai['hargajualan'] - $harga_tebus;
|
||||
}
|
||||
|
||||
$create_tebus = Tebus::on($cawangan['mysql'])->create([
|
||||
'kodcaw'=> $kodcaw,
|
||||
|
||||
-78
@@ -1,78 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class UpdateJenisToPampasanForSempornaRecords extends Migration
|
||||
{
|
||||
/**
|
||||
* Semporna norujukan records to update
|
||||
*/
|
||||
private function getSempornaRecords(): array
|
||||
{
|
||||
return [
|
||||
'011237240808-0003',
|
||||
'011237240719-0015',
|
||||
'011237240806-0011',
|
||||
'011237240828-0001',
|
||||
'011237240904-0007',
|
||||
'011237240904-0008',
|
||||
'011237240904-0009',
|
||||
'011237240719-0023',
|
||||
'011237240719-0024',
|
||||
'011237240719-0025',
|
||||
'011237240618-0026',
|
||||
'011237240719-0027',
|
||||
'011237240719-0028',
|
||||
'011237240618-0020',
|
||||
'011237240719-0030',
|
||||
'011237240618-0029',
|
||||
'011237240731-0026',
|
||||
'011237240912-0009'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$semporna_records = $this->getSempornaRecords();
|
||||
|
||||
// Update jenis to 'pampasan' for Semporna records in mysql34 (Semporna branch)
|
||||
try {
|
||||
$updated = DB::connection('mysql34')->table('palsu')
|
||||
->whereIn('norujukan', $semporna_records)
|
||||
->update(['jenis' => 'pampasan']);
|
||||
|
||||
echo "Updated {$updated} Semporna records with jenis = 'pampasan'\n";
|
||||
} catch (\Exception $e) {
|
||||
echo "Error updating Semporna records: " . $e->getMessage() . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
$semporna_records = $this->getSempornaRecords();
|
||||
|
||||
// Revert jenis to null for Semporna records
|
||||
try {
|
||||
$reverted = DB::connection('mysql34')->table('palsu')
|
||||
->whereIn('norujukan', $semporna_records)
|
||||
->update(['jenis' => null]);
|
||||
|
||||
echo "Reverted {$reverted} Semporna records jenis to null\n";
|
||||
} catch (\Exception $e) {
|
||||
echo "Error reverting Semporna records: " . $e->getMessage() . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
-130
@@ -1,130 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class UpdateNonSempornaRecordsJenisToHapuskira extends Migration
|
||||
{
|
||||
/**
|
||||
* Get active database connections
|
||||
*/
|
||||
private function getActiveDB(): array
|
||||
{
|
||||
$config_db = array_keys(config("database.connections"));
|
||||
|
||||
$db_connection = array_filter($config_db, function($connection) {
|
||||
try {
|
||||
if ($connection == 'mysql7') {
|
||||
return false;
|
||||
}
|
||||
|
||||
DB::connection($connection)->select('SELECT 1');
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
return $db_connection ? array_values($db_connection) : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Semporna norujukan records to exclude
|
||||
*/
|
||||
private function getSempornaRecords(): array
|
||||
{
|
||||
return [
|
||||
'011237240808-0003',
|
||||
'011237240719-0015',
|
||||
'011237240806-0011',
|
||||
'011237240828-0001',
|
||||
'011237240904-0007',
|
||||
'011237240904-0008',
|
||||
'011237240904-0009',
|
||||
'011237240719-0023',
|
||||
'011237240719-0024',
|
||||
'011237240719-0025',
|
||||
'011237240618-0026',
|
||||
'011237240719-0027',
|
||||
'011237240719-0028',
|
||||
'011237240618-0020',
|
||||
'011237240719-0030',
|
||||
'011237240618-0029',
|
||||
'011237240731-0026',
|
||||
'011237240912-0009'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$db_connection = $this->getActiveDB();
|
||||
$semporna_records = $this->getSempornaRecords();
|
||||
|
||||
foreach ($db_connection as $dbase) {
|
||||
try {
|
||||
if ($dbase == 'mysql34') {
|
||||
// For Semporna (mysql34), update only non-Semporna records to 'hapuskira'
|
||||
$updated = DB::connection($dbase)->table('palsu')
|
||||
->whereNotIn('norujukan', $semporna_records)
|
||||
->update(['jenis' => 'hapuskira']);
|
||||
|
||||
if ($updated > 0) {
|
||||
echo "Updated {$updated} non-Semporna records in {$dbase} to jenis = 'hapuskira'\n";
|
||||
}
|
||||
} else {
|
||||
// For all other databases, update all records to 'hapuskira'
|
||||
$updated = DB::connection($dbase)->table('palsu')
|
||||
->update(['jenis' => 'hapuskira']);
|
||||
|
||||
if ($updated > 0) {
|
||||
echo "Updated {$updated} records in {$dbase} to jenis = 'hapuskira'\n";
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
echo "Error updating {$dbase}: " . $e->getMessage() . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
$db_connection = $this->getActiveDB();
|
||||
|
||||
foreach ($db_connection as $dbase) {
|
||||
try {
|
||||
// Revert all jenis values to null except Semporna records which should remain 'pampasan'
|
||||
if ($dbase == 'mysql34') {
|
||||
$semporna_records = $this->getSempornaRecords();
|
||||
$reverted = DB::connection($dbase)->table('palsu')
|
||||
->whereNotIn('norujukan', $semporna_records)
|
||||
->update(['jenis' => null]);
|
||||
|
||||
if ($reverted > 0) {
|
||||
echo "Reverted {$reverted} non-Semporna records in {$dbase} jenis to null\n";
|
||||
}
|
||||
} else {
|
||||
$reverted = DB::connection($dbase)->table('palsu')
|
||||
->update(['jenis' => null]);
|
||||
|
||||
if ($reverted > 0) {
|
||||
echo "Reverted {$reverted} records in {$dbase} jenis to null\n";
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
echo "Error reverting {$dbase}: " . $e->getMessage() . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
-18
@@ -5,7 +5,7 @@ use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class AddJenisColumnToPalsuTable extends Migration
|
||||
class AddAgreementPrintedAtToPampasanTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Get active database connections
|
||||
@@ -16,17 +16,13 @@ class AddJenisColumnToPalsuTable extends Migration
|
||||
|
||||
$db_connection = array_filter($config_db, function($connection) {
|
||||
try {
|
||||
if ($connection == 'mysql7') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($connection === 'mysql7') return false; // ikut pattern sedia ada
|
||||
DB::connection($connection)->select('SELECT 1');
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
return $db_connection ? array_values($db_connection) : [];
|
||||
}
|
||||
|
||||
@@ -37,12 +33,10 @@ class AddJenisColumnToPalsuTable extends Migration
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$db_connection = $this->getActiveDB();
|
||||
|
||||
foreach ($db_connection as $dbase) {
|
||||
Schema::connection($dbase)->table('palsu', function (Blueprint $table) use ($dbase) {
|
||||
if (!Schema::connection($dbase)->hasColumn('palsu', 'jenis')) {
|
||||
$table->string('jenis', 50)->nullable()->comment('Jenis/Type classification');
|
||||
foreach ($this->getActiveDB() as $dbase) {
|
||||
Schema::connection($dbase)->table('pampasan', function (Blueprint $table) use ($dbase) {
|
||||
if (!Schema::connection($dbase)->hasColumn('pampasan', 'agreement_printed_at')) {
|
||||
$table->timestamp('agreement_printed_at')->nullable()->comment('Timestamp when agreement was printed');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -55,12 +49,10 @@ class AddJenisColumnToPalsuTable extends Migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
$db_connection = $this->getActiveDB();
|
||||
|
||||
foreach ($db_connection as $dbase) {
|
||||
Schema::connection($dbase)->table('palsu', function (Blueprint $table) use ($dbase) {
|
||||
if (Schema::connection($dbase)->hasColumn('palsu', 'jenis')) {
|
||||
$table->dropColumn('jenis');
|
||||
foreach ($this->getActiveDB() as $dbase) {
|
||||
Schema::connection($dbase)->table('pampasan', function (Blueprint $table) use ($dbase) {
|
||||
if (Schema::connection($dbase)->hasColumn('pampasan', 'agreement_printed_at')) {
|
||||
$table->dropColumn('agreement_printed_at');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -380,6 +380,7 @@ $router->group(['prefix'=>'api'], function () use ($router){
|
||||
$router->post('DeletePanjar/{kodcaw}',['uses'=>'PanjarController@delete']);
|
||||
|
||||
//API PAMPASAN GUNA PANJAR
|
||||
$router->post('pampasan/initiatePampasan',['uses'=>'PampasanController@initiatePampasan']);
|
||||
$router->post('pampasan/terimaPampasan',['uses'=>'PampasanController@terimaPampasan']);
|
||||
$router->put('pampasan/updateStatusPampasan', ['uses' => 'PampasanController@updateStatusPampasan']);
|
||||
$router->get('pampasan', ['uses' => 'PampasanController@getPampasan']);
|
||||
|
||||
Reference in New Issue
Block a user