function logsession
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\LogSession;
|
||||
use App\Cawangan;
|
||||
use App\Logsession as AppLogsession;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
class LogController extends Controller
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function logSession($kodcaw, Request $request)
|
||||
{
|
||||
// dd($request->all());
|
||||
|
||||
$logsession = Logsession::on('mysql7')->where('kodcaw', '=', $kodcaw)
|
||||
->create([
|
||||
'nama' => $request->nama,
|
||||
'nokp' => $request->nokp,
|
||||
'kodcaw' => $request->kodcaw,
|
||||
'email' => $request->email,
|
||||
'taraf' => $request->taraf,
|
||||
|
||||
]);
|
||||
|
||||
|
||||
return response()->json($logsession);
|
||||
}
|
||||
|
||||
public function checkNokpSession($kodcaw, $nokp, $tarikh)
|
||||
{
|
||||
|
||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw', '=', $kodcaw)->first();
|
||||
|
||||
$checknokp = Logsession::on('mysql7')->where('kodcaw', '=', $kodcaw)
|
||||
->where('nokp', '=', $nokp)
|
||||
->where('created_at','LIKE',"%{$tarikh}%")
|
||||
->get();
|
||||
|
||||
if (sizeof($checknokp) != 0) {
|
||||
$newnokp = $nokp;
|
||||
} else {
|
||||
|
||||
$newnokp = 'NULL';
|
||||
}
|
||||
return response()->json($newnokp);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user