update user logs

This commit is contained in:
Pringgosutono
2025-10-21 03:18:05 +07:00
parent 0b79bd665c
commit 8b833e7295
4 changed files with 72 additions and 21 deletions

View File

@ -17,6 +17,7 @@ use App\Models\ConfTruckTypes;
use App\Models\Vehicles;
use App\Models\UserLogs;
use Auth;
use App\Models\Users;
class UserLogsController extends Controller
{
@ -26,9 +27,11 @@ class UserLogsController extends Controller
public function view_user_logs(Request $req)
{
$data = [];
$users = Users::listUsers();
$data = [
"users" => $users,
];
$log = [
"module" => "User Logs",
"action" => "View",
@ -42,13 +45,16 @@ class UserLogsController extends Controller
try {
$tgl0 = $req->tgl0;
$tgl1 = $req->tgl1;
$userId = $req->userId;
$d = [$tgl0, $tgl1];
$d = [$tgl0, $tgl1, $userId, $userId];
$list = DB::select("SELECT
a.*, b.email
FROM t_user_log a
join t_users b on a.userId = b.id
WHERE a.crt BETWEEN ? AND ?
WHERE
a.crt BETWEEN ? AND ?
and if(? , a.userId = ? , 1=1)
order by a.crt desc
", $d);