added audit logs for operasi
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Audit;
|
||||||
use App\MaxMutuEmas;
|
use App\MaxMutuEmas;
|
||||||
use App\MaxPinjaman;
|
use App\MaxPinjaman;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@@ -125,6 +126,7 @@ class MaxPinjamanController extends Controller
|
|||||||
'teller' => 'required|numeric|min:0|max:100',
|
'teller' => 'required|numeric|min:0|max:100',
|
||||||
'pc' => 'required|numeric|min:0|max:100',
|
'pc' => 'required|numeric|min:0|max:100',
|
||||||
'operasi' => 'required|numeric|min:0|max:100',
|
'operasi' => 'required|numeric|min:0|max:100',
|
||||||
|
'username' => 'required|string|max:255'
|
||||||
], [
|
], [
|
||||||
'recno.required' => 'Nombor rekod diperlukan.',
|
'recno.required' => 'Nombor rekod diperlukan.',
|
||||||
'recno.integer' => 'Nombor rekod mesti berupa nombor.',
|
'recno.integer' => 'Nombor rekod mesti berupa nombor.',
|
||||||
@@ -162,10 +164,15 @@ class MaxPinjamanController extends Controller
|
|||||||
$teller = $request->teller;
|
$teller = $request->teller;
|
||||||
$pc = $request->pc;
|
$pc = $request->pc;
|
||||||
$operasi = $request->operasi;
|
$operasi = $request->operasi;
|
||||||
|
$username = $request->username;
|
||||||
|
|
||||||
|
$current = \Carbon\Carbon::now();
|
||||||
|
|
||||||
$maxmutuemas = MaxMutuEmas::on('mysql7')->where('recno', $recno)->first();
|
$maxmutuemas = MaxMutuEmas::on('mysql7')->where('recno', $recno)->first();
|
||||||
|
|
||||||
if ($maxmutuemas) {
|
if ($maxmutuemas) {
|
||||||
|
$oldmax = $maxmutuemas->toJson();
|
||||||
|
|
||||||
$maxmutuemas->karat = $karat;
|
$maxmutuemas->karat = $karat;
|
||||||
$maxmutuemas->keterangan = $keterangan;
|
$maxmutuemas->keterangan = $keterangan;
|
||||||
$maxmutuemas->teller = $teller;
|
$maxmutuemas->teller = $teller;
|
||||||
@@ -174,6 +181,17 @@ class MaxPinjamanController extends Controller
|
|||||||
$maxmutuemas->tarikhupdate = \Carbon\Carbon::now();
|
$maxmutuemas->tarikhupdate = \Carbon\Carbon::now();
|
||||||
$maxmutuemas->save();
|
$maxmutuemas->save();
|
||||||
|
|
||||||
|
Audit::create([
|
||||||
|
'users' => $username,
|
||||||
|
'actions' => 'Penukaran Mutu Margin',
|
||||||
|
'norujukan' => '-',
|
||||||
|
'new_data' => $maxmutuemas->toJson(),
|
||||||
|
'old_data' => $oldmax,
|
||||||
|
'kodcaw' => 'OPERASI',
|
||||||
|
'created_at' => $current,
|
||||||
|
'updated_at' => $current,
|
||||||
|
]);
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
'message' => 'Max Mutu Emas updated successfully',
|
'message' => 'Max Mutu Emas updated successfully',
|
||||||
|
|||||||
Reference in New Issue
Block a user