redirect to game summary page
This commit is contained in:
parent
d0b5f51aeb
commit
1d1e26619a
@ -52,7 +52,16 @@ class GameController extends Controller
|
||||
$i = DB::table('game_puzzles')->get()->where('game_id', $id)->values()->get($puzzle-1)->id;
|
||||
DB::table('game_puzzles')->where('id', $i)->update(['hit' => 1]);
|
||||
}
|
||||
return redirect("/play/" . $id . '/' . ($puzzle+1));
|
||||
if($puzzle < DB::table('game_puzzles')->where('game_id', $id)->count()){
|
||||
return redirect("/play/" . $id . '/' . ($puzzle+1));
|
||||
}else{
|
||||
return redirect("/results/" . $id);
|
||||
}
|
||||
}
|
||||
|
||||
public function summarize($id){
|
||||
$puzzles = DB::table('game_puzzles')->where('game_id', $id)->get();
|
||||
return view('game/results', ['puzzles' => $puzzles]);
|
||||
}
|
||||
|
||||
public function list($userID) {
|
||||
|
@ -7,6 +7,8 @@
|
||||
$answer = $puzzle->answer;
|
||||
$pic = $puzzle->picture;
|
||||
|
||||
$validation_url = dirname($_SERVER["REQUEST_URI"]) . '/' . $nth . '/validate';
|
||||
|
||||
if($debug){
|
||||
var_dump($puzzle);
|
||||
}
|
||||
@ -43,7 +45,7 @@
|
||||
|
||||
<div class="col-12 col-lg-8">
|
||||
<form method=post
|
||||
action={{ dirname($_SERVER["REQUEST_URI"]) . '/' . $nth . '/validate' }}
|
||||
action={{ $validation_url }}
|
||||
id="tippForm"
|
||||
onsubmit="return preguess()"
|
||||
>
|
||||
@ -61,7 +63,11 @@
|
||||
</div>
|
||||
<button class="btn btn-success mb-2">Beküldés</button>
|
||||
</form>
|
||||
<form action={{ dirname($_SERVER["REQUEST_URI"]) . '/' . $nth + 1 }}>
|
||||
<form method=post
|
||||
action={{ $validation_url }}
|
||||
>
|
||||
@csrf
|
||||
<input name="tipp" class="d-none" value=""></input>
|
||||
<button class="btn btn-danger">Passz</button>
|
||||
</form>
|
||||
</div>
|
||||
|
10
picquiz/resources/views/game/results.blade.php
Normal file
10
picquiz/resources/views/game/results.blade.php
Normal file
@ -0,0 +1,10 @@
|
||||
@extends('template')
|
||||
|
||||
@section('title')
|
||||
<title>Eredmények</title>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="container bg-dark text-white p-4 rounded-3" style="--bs-bg-opacity: .98;">
|
||||
</div>
|
||||
@endsection
|
@ -68,6 +68,8 @@ Route::get('/play/{id}/{puzzle}', [GameController::class, 'play']);
|
||||
|
||||
Route::post('/play/{id}/{puzzle}/validate', [GameController::class, 'do_validate']);
|
||||
|
||||
Route::get('/results/{id}', [GameController::class, 'summarize']);
|
||||
|
||||
Route::get('/games/{userID}/list', [GameController::class, 'list']);
|
||||
|
||||
//--------- Admin routes --------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user