feat Log Masuk & Keluar Sistem
This commit is contained in:
@@ -10,6 +10,7 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use App\Audit;
|
||||
|
||||
class LogController extends Controller
|
||||
{
|
||||
@@ -20,7 +21,8 @@ class LogController extends Controller
|
||||
|
||||
public function logSession($kodcaw, Request $request)
|
||||
{
|
||||
// dd($request->all());
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
|
||||
$logsession = Logsession::on('mysql7')->where('kodcaw', '=', $kodcaw)
|
||||
->create([
|
||||
@@ -31,6 +33,18 @@ class LogController extends Controller
|
||||
'taraf' => $request->taraf,
|
||||
|
||||
]);
|
||||
|
||||
$audit = new Audit();
|
||||
$audit->users = $request->nama;
|
||||
$audit->actions = "Log Masuk";
|
||||
// $audit->norujukan = $norujukan;
|
||||
// $audit->old_data = $old_data;
|
||||
$audit->kodcaw = $kodcaw;
|
||||
$audit->created_at = $current;
|
||||
$audit->updated_at = $current;
|
||||
$audit->save();
|
||||
|
||||
|
||||
|
||||
|
||||
return response()->json($logsession);
|
||||
@@ -55,5 +69,36 @@ class LogController extends Controller
|
||||
return response()->json($newnokp);
|
||||
}
|
||||
|
||||
public function logoutSession($kodcaw, Request $request)
|
||||
{
|
||||
$current = Carbon::now();
|
||||
$current = new Carbon();
|
||||
|
||||
$logoutsession = Logsession::on('mysql7')->where('kodcaw', '=', $kodcaw)
|
||||
->create([
|
||||
'nama' => $request->nama,
|
||||
'nokp' => $request->nokp,
|
||||
'kodcaw' => $request->kodcaw,
|
||||
'email' => $request->email,
|
||||
'taraf' => $request->taraf,
|
||||
|
||||
]);
|
||||
|
||||
$audit = new Audit();
|
||||
$audit->users = $request->nama;
|
||||
$audit->actions = "Log Keluar";
|
||||
// $audit->norujukan = $norujukan;
|
||||
// $audit->old_data = $old_data;
|
||||
$audit->kodcaw = $kodcaw;
|
||||
$audit->created_at = $current;
|
||||
$audit->updated_at = $current;
|
||||
$audit->save();
|
||||
|
||||
|
||||
|
||||
|
||||
return response()->json($logsession);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user