Hi guys I have been struggling finding a way to catch and handle my 500 errors. I am trying to write data to a MySql database. The method in my controller receives all the data with no problem The following is the code in the method
public function new_league(Request $request)
{
$venueIDAR = \App\Venue::where('name',$request->venue_name)->get();
$venueID = \App\Venue::find($venueIDAR[0]->id);
$venueID = $venueID->id;
$venueName = ($request->venue_name);
$venueName = str_replace(' ', '_', $venueName);
$lDate = ($request->date);
$dateDay = date('D', strtotime($lDate));
$lDate = str_replace('-', '_', $lDate);
$leagueName = $venueName . '_' . $dateDay . '_' . $lDate;
$lDate = str_replace('_', '-', $lDate);
$new_league = \App\Leagues::create([
'LeagueName' => $leagueName,
'venueId' => $venueID,
'date' => $request->date . ":00",
]);
return $new_league;
//$TheLeague->save();
return redirect()->back();
}
Everything works up until the following code
$new_league = \App\Leagues::create([
'LeagueName' => $leagueName,
'venueId' => $venueID,
'date' => $request->date,
]);
Then I receive a 500 error, I have tried checking the log file but its not logging this problem. How do I catch this exception to get a more detailed response than just 500. This will greatly help me with future problems as well
Thank you
Aucun commentaire:
Enregistrer un commentaire