TippsController.store: Handling Auth::user() being null value
This commit is contained in:
parent
f6a5934439
commit
81143a0fa6
4 changed files with 53022 additions and 6 deletions
52995
dumps/d0274241_2020-03-12_1533.sql
Normal file
52995
dumps/d0274241_2020-03-12_1533.sql
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -132,6 +132,17 @@ class TippsController extends Controller
|
||||||
|
|
||||||
$user=Auth::user();
|
$user=Auth::user();
|
||||||
|
|
||||||
|
if ( is_null($user) ) {
|
||||||
|
Log::info("TippsController.store: No authenticated user detected. Aborting storage command.");
|
||||||
|
$tippLink="/tipps#";
|
||||||
|
$r=\App\Round::getFirstTippableRound();
|
||||||
|
if($r) $tippLink=$tippLink.$r->id;
|
||||||
|
|
||||||
|
// Redirect to the Rounds Index
|
||||||
|
return redirect($tippLink);
|
||||||
|
}
|
||||||
|
Log::info("TippsController::store for user-id ".$user->id);
|
||||||
|
|
||||||
// Fetch, modify, save Tipp
|
// Fetch, modify, save Tipp
|
||||||
$tipp = Tipp::where('id', request('id'))->first();
|
$tipp = Tipp::where('id', request('id'))->first();
|
||||||
$game = Game::where('id', $tipp->game_id)->first();
|
$game = Game::where('id', $tipp->game_id)->first();
|
||||||
|
|
@ -204,7 +215,11 @@ class TippsController extends Controller
|
||||||
// If one fails, previous saves are kept, but user
|
// If one fails, previous saves are kept, but user
|
||||||
// is redirected to edit4 page again.
|
// is redirected to edit4 page again.
|
||||||
public function store4() {
|
public function store4() {
|
||||||
|
Log::debug("### Store4 ###");
|
||||||
|
error_log("--- Store4 ---");
|
||||||
// Validate form
|
// Validate form
|
||||||
|
|
||||||
|
//dd(request());
|
||||||
$this->validate(request(), [
|
$this->validate(request(), [
|
||||||
'round_id' => 'required',
|
'round_id' => 'required',
|
||||||
'game_id_1' => 'required',
|
'game_id_1' => 'required',
|
||||||
|
|
@ -222,9 +237,9 @@ class TippsController extends Controller
|
||||||
'score2_1' => 'required',
|
'score2_1' => 'required',
|
||||||
'score2_2' => 'required',
|
'score2_2' => 'required',
|
||||||
'score2_3' => 'required',
|
'score2_3' => 'required',
|
||||||
'score2_4' => 'required',
|
'score2_4' => 'required'
|
||||||
'round_id' => 'required'
|
|
||||||
]);
|
]);
|
||||||
|
error_log("Validation passed.");
|
||||||
|
|
||||||
$round_id= request('round_id');
|
$round_id= request('round_id');
|
||||||
$game_id_1=request('game_id_1');
|
$game_id_1=request('game_id_1');
|
||||||
|
|
@ -280,7 +295,13 @@ class TippsController extends Controller
|
||||||
return redirect('/tipps/edit4/'.$round_id);
|
return redirect('/tipps/edit4/'.$round_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect('/tipps/');
|
$tippLink="/tipps#";
|
||||||
|
$r=\App\Round::getFirstTippableRound();
|
||||||
|
if($r) $tippLink=$tippLink.$r->id;
|
||||||
|
|
||||||
|
// Redirect to the Rounds Index
|
||||||
|
return redirect($tippLink);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store tipp if valid.
|
// Store tipp if valid.
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ return [
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'debug' => env('APP_DEBUG', false),
|
'debug' => env('APP_DEBUG', true),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -86,8 +86,8 @@
|
||||||
<input type="checkbox" name="joker_3" id="joker_3" @if($tipp3->joker===1) checked @endif>
|
<input type="checkbox" name="joker_3" id="joker_3" @if($tipp3->joker===1) checked @endif>
|
||||||
|
|
||||||
<span>
|
<span>
|
||||||
<input type="hidden" name="tipp_id_2" value="{{ $tipp3->id }}">
|
<input type="hidden" name="tipp_id_3" value="{{ $tipp3->id }}">
|
||||||
<input type="hidden" name="game_id_2" value="{{ $game3->id }}">
|
<input type="hidden" name="game_id_3" value="{{ $game3->id }}">
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<!-- 4 -->
|
<!-- 4 -->
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue