Here's my method:
public function update(Request $request)
{
$test_results= CeuResult::findOrFail($request->the_quiz_id);
if($request->pass <> $test_results->pass) {
if($request->pass==1) {
$test_results->attempts=1;
$test_results->quiz_date=date('Y-m-d');
$test_results->status='PASSED';
$test_results->pass=1;
$test_results->save();
}
else {
$test_results->attempts=0;
$test_results->pass=$request->pass;
$test_results->quiz_date=NULL;
$test_results->status=NULL;
$test_results->save();
}
}
$customer=CeuUser::findOrFail($request->the_id);
//update ceu_users table
$customer->winclose=$request->winclose;
$success='User was successfully updated!';
if($customer->save()) {
Session::flash('message', 'User was successfully updated!');
return redirect('/admin/show/cuser/'.$request->the_id);
}
}
Here's a screenshot of the site we're looking at:
What I need to do is update the "Window Close" date.
That will happen at this point in the code:
$customer=CeuUser::findOrFail($request->the_id);
//update ceu_users table
$customer->winclose=$request->winclose;
$success='User was successfully updated!';
The thing is, when I click on submit, I get a 404 error.
My routes look like this:
Route::get('/list/cuser', 'CUserController@index')->name('adminListCUsers');
Route::get('/show/cuser/{id}', 'CUserController@show')->name('adminShowCUser');
Route::post('/update/cuser', 'CUserController@update')->name('adminUpdateCUser');
Route::post('/update/cuser/status', 'CUserController@update_status')->name('adminUpdateCUserStatus');
Route::post('/delete/cuser', 'CUserController@destroy')->name('adminDeleteCUser');
I can do this:
public function update(Request $request)
{
echo "hello";
...and get a "hello," so this:
Route::post('/update/cuser', 'CUserController@update')->name('adminUpdateCUser');
...is working fine.
But something's going south within the function housed in the Controller and I'm not even sure how to troubleshoot it.
Why would I get a 404? How do I figure out what's wrong?
Thanks, Chris!