MIF_E31231392/app/Http/Controllers/TutorialTesController.php

91 lines
2.3 KiB
PHP

<?php
namespace App\Http\Controllers;
use App\Models\TestSessionsModel;
use Illuminate\Http\Request;
class TutorialTesController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index(Request $request)
{
/**
* TODO
* 1. simpan sesi tobii di db
* 2. simpan data mata lewat db
* 3. di tabel session harus ada is_active atau lainnya biar nanti kalo misal aktif ujian, data mata di terima dan langsung dimasukkan wifi
* 4. pada backend tobii, masukin token dan id yang ada di tabel session, biar nanti di compare cocok atau tidak
* 5. itu aja sih
*/
$id_session = null;
if(session('id_test_sessions') != null) {
$id_session = session('id_test_sessions');
} else if($request->id_test_sessions != null) {
$id_session = $request->id_test_sessions;
} else {
return redirect()->route('cek-status.index')->with('error', 'Data sesi tes tidak ditemukan. Silakan mulai tes terlebih dahulu.');
}
$data_session = TestSessionsModel::where('id_test_sessions', $id_session)->first();
if($data_session != null) {
if($data_session->status_session == '0') {
$data_session->update(['status_session' => '1']);
}
} else {
return redirect()->route('cek-status.index')->with('error', 'Data sesi tes tidak ditemukan. Silakan mulai tes terlebih dahulu.');
}
return view('user.pages.tutorial_tes.index', compact('data_session'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}