MIF_E31231392/app/Http/Controllers/TobiiReceiverController.php

77 lines
1.6 KiB
PHP

<?php
namespace App\Http\Controllers;
use App\Models\TestSessionsModel;
use Illuminate\Http\Request;
class TobiiReceiverController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
$data_sessions = TestSessionsModel::where('id_test_sessions', $request->id_test_sessions)->first();
if($data_sessions != null) {
if($request->token_session == $data_sessions->token_session) {
// simpan data tobii ke db
return response()->json(['message' => 'Data tobii berhasil disimpan.'], 200);
} else {
return response()->json(['message' => 'Token sesi tidak valid.'], 401);
}
} else {
return response()->json(['message' => 'Data sesi tes tidak ditemukan.'], 404);
}
}
/**
* 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)
{
//
}
}