95 lines
2.1 KiB
PHP
95 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\TestSessionsModel;
|
|
use Illuminate\Http\Request;
|
|
|
|
class TestSessionsController 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)
|
|
{
|
|
$request->validate([
|
|
'id_booking' => 'required|exists:booking,id_booking',
|
|
]);
|
|
|
|
$testSession = TestSessionsModel::create([
|
|
'id_booking' => $request->id_booking,
|
|
'status_session' => '0',
|
|
'is_active' => '0',
|
|
]);
|
|
|
|
return redirect()->route('tutorial-tes.index')->with([
|
|
'id_booking' => $testSession->id_booking,
|
|
'id_test_sessions' => $testSession->id_test_sessions,
|
|
'token_session' => $testSession->token_session,
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Display the specified resource.
|
|
*/
|
|
public function show(string $id)
|
|
{
|
|
$data = TestSessionsModel::where('id_booking', $id)->first();
|
|
if($data != null) {
|
|
return response()->json([
|
|
'status' => true,
|
|
'msg' => 'Data ditemukan (' . $id . ')',
|
|
'status_session' => $data->status_session,
|
|
'token_session' => $data->token_session,
|
|
'id_booking' => $data->id_booking,
|
|
'id_test_sessions' => $data->id_test_sessions,
|
|
]);
|
|
|
|
}
|
|
return response()->json([
|
|
'status' => false,
|
|
'msg' => 'Data tidak ditemukan (' . $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)
|
|
{
|
|
//
|
|
}
|
|
}
|