Link to home
Start Free TrialLog in
Avatar of Bruce Gust
Bruce GustFlag for United States of America

asked on

Why is this Laravel UPDATE statement not happening?

This is what my screen looks like right now. The field that's got me perplexed is the one that I've got in a black box...


User generated imageThis should be cake and ice cream. I want to change the date in that field, but when I hit "Submit," nothing happens and I'm not sure how to, not only fix it, but even in the context of troubleshooting, is there a way you can "print" the query to see what it is the system is processing?


The URL of the page you're seeing is: http://new.brucegust.com/admin/rltest/edit/595


Here's the blade:


@extends('../layouts.satellite')
@section('content') <!-- Section: intro --> <section id="intro" class="intro">    <div class="satellite-content">       <div class="container">          <div class="row">             <div class="col-xs-12 satellite_row">                <h5>Edit a License Renewal or Reliability Test</h5>                <div class="row">                   <div class="col-xs-12">                   Hello, {{ Auth::user()->name }}!                   <br><br>                   Make entries as required, click 'Submit' to preserve, 'Cancel' to quit without saving.                   <br><br>                   Click <a href="{{ route('adminDashboard') }}" style="font-weight:bold;">here</a> to return to the admin page.                   <br><br>                   @include('includes/admin_help')                   <br><br>                   Thanks!                   </div>                </div>                <div class="row">                   <div class="col-xs-12"><hr></div>                </div>                @if($errors->any())                   <div class="alert alert-danger">                      <ul>                         @foreach($errors->all() as $error)                            <li>{{ $error }} </li>                         @endforeach                      </ul>                   </div>                @endif                <!--form method="Post" action="{{ route('adminStoreRltest') }}"-->                <form method="Post" action="{{ route('adminUpdateRltest') }}">                   <input type="hidden" name="id" value="{{$test->id}}" />                   <input type="hidden" value="{{csrf_token()}}" name="_token">                   <div class="form-group">                      <div class="row">                         <div class="col-md-6 col-xs-12">                            <label for="testnum">Test Number:</label>                             <select name="testnum" value="{{ $test->testnum }}"  class="form-control">                               <option value="">-- SELECT --</option>                               <option value="2" @if($test->testnum == "2") selected @endif >Reliability Test #2</option>                               <option value="3" @if($test->testnum == "3") selected @endif >Reliability Test #3</option>                               <option value="6" @if($test->testnum == "6") selected @endif >Reliability Test #4</option>                               <option value="4" @if($test->testnum == "4") selected @endif >Re-Licensing Test #1</option>                               <option value="5" @if($test->testnum == "5") selected @endif >Re-Licensing Test #2</option>                            </select>                                        <div class='caption'>Click dropdown to select.</div>                         </div>                         <div class="col-md-6 col-xs-12">                            <label for="name">Name:</label>                            <input name="name" type="text" value="{{ $test->name }}" size="30" maxlength="100" class="form-control">                                   <div class='caption'>First and Last.</div>                         </div>                      </div>                      <div class="row">                         <div class="col-md-6 col-xs-12">                            <label for="email">Client Email:</label>                            <input name="email" type="text" value="{{ $test->email }}" size="30" maxlength="100" class="form-control">                                    <div class='caption'>Required for client login.</div>                          </div>                         <div class="col-md-6 col-xs-12">                            <label for="ordernum">Order Number:</label>                            <input name="ordernum" type="text" size="30" maxlength="20" class="form-control" value="{{$test->ordernum}}">                                    <div class='caption'>DO NOT CHANGE. Give this number to the client for login.</div>                           </div>                      </div>                      <div class="row">                         <div class="col-md-6 col-xs-12">                            <label for="weekbegin">Week Begins:</label>                            <input data-provide="datepicker" data-date-format="yyyy-mm-dd" name="weekopen" id="datepicker0" type="text" value="{{ $test->weekopen }}" size="30" maxlength="10" class="form-control" autocomplete="123">                            <div class='caption'>Click date for pop-up calendar. This date starts the 7-day availability period.<br>Manual entry must be formatted "yyyy-mm-dd".</div>                                                        </div>                         <div class="col-md-6 col-xs-12">                            <label for="weekclose">Week Ends:</label>                            <input data-provide="datepicker" data-date-format="yyyy-mm-dd" name="weekclose" id="datepicker0" type="text" value="{{ $test->weekclose }}" size="30" maxlength="10" class="form-control" autocomplete="123">                            <div class='caption'>Click date for pop-up calendar. This date starts the 7-day availability period.<br>Manual entry must be formatted "yyyy-mm-dd".</div>                                                        </div>                         <div class="col-md-6 col-xs-12">                            <label for="winopen">Window Opens:</label>                            <input data-provide="datepicker" data-date-format="yyyy-mm-dd" name="winopen" id="datepicker0" type="text" value="{{ $test->winopen }}" size="30" maxlength="10" class="form-control" autocomplete="123">                            <div class='caption'>Click date for pop-up calendar. This date starts the 7-day availability period.<br>Manual entry must be formatted "yyyy-mm-dd".</div>                                                        </div>                         <div class="col-md-6 col-xs-12">                            <label for="winclose">Window Closes:</label>                            <input data-provide="datepicker" data-date-format="yyyy-mm-dd" name="winclose" id="datepicker0" type="text" value="{{ $test->winclose }}" size="30" maxlength="10" class="form-control" autocomplete="123">                            <div class='caption'>Click date for pop-up calendar. This date starts the 7-day availability period.<br>Manual entry must be formatted "yyyy-mm-dd".</div>                                                                                      </div>                      </div>                      <div class="row">                         <div class="col-xs-12" style="text-align:center;"><br>                            <input type="image" name="submit" src="{{ asset('assets/img/nomas_submit.jpg') }}" style="width:150px;"><br>                            <a href="/admin/rltest/summary" class="">Cancel</a>                         </div>                      </div></form>                   </div>                </form>             </div>          </div>       </div>    </div> </section> @endsection

Open in new window

Here's the Controller:


<?php
namespace App\Http\Controllers; use Illuminate\Http\Request; use App\AppsTestskedUsers; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Session; use View; use Redirect; use App\Http\Requests\CreateRltestRequest; use App\Http\Requests\UpdateRltestRequest; use App\Http\Requests\DeleteRltestRequest; /* the CeuUser and the CeuOrder models might look a little redundanct given the fact the we have a CeuController. The thing is, that Controller is all about the quizzes and the campus. Here they're utilized for the sake of listing orders, editing access periods and being able to give away product. */ class RltestController extends Controller {     /**      * Display a listing of the resource.      *      * @return \Illuminate\Http\Response      */          public function __construct() {         $this->middleware('checkRole: admin');     }         public function index()     {       $testsummaries = array();       $test_num_array = array(2,3,4,5);       foreach($test_num_array as $test_num){          $test_tot   = AppsTestskedUsers::sortable()->where('testnum',$test_num)->count();          $test_begun   = AppsTestskedUsers::sortable()->where('testnum',$test_num)->where('winopen', '<>', '0000-00-00')->count();          $test_done   = AppsTestskedUsers::sortable()->where('testnum',$test_num)->where('winclose', '<>', '0000-00-00')->count();          $test_show  = $test_num;          if($test_num == '4') $test_show = 1;          if($test_num == '5') $test_show = 2;                    $test_name = "Test Number $test_show";          $testsummaries[] = array('test_num' =>$test_num,'test_tot' =>$test_tot,'test_begun' =>$test_begun,'test_done' =>$test_done,'test_name' =>$test_name);                 }             return view('admin/SummaryRltest', compact('testsummaries'));     }     /**      * Show the form for creating a new resource.      *      * @return \Illuminate\Http\Response      */     public function create()     {         //       return view('admin.insertRltest');     }     /**      * Store a newly created resource in storage.      *      * @param  \Illuminate\Http\Request  $request      * @return \Illuminate\Http\Response      */     public function store(CreateRltestRequest $request)     {        $validated = $request->validated();       $AppsTestskedUsers = new AppsTestskedUsers;       $AppsTestskedUsers->name=$request->input('name');       $AppsTestskedUsers->email=$request->input('email');       $AppsTestskedUsers->testnum=$request->input('testnum');       $AppsTestskedUsers->ordernum=$request->input('ordernum');       $AppsTestskedUsers->weekopen=$request->input('weekbegin');       $AppsTestskedUsers->weekclose=date('Y-m-d',strtotime("+7 day",strtotime($request->input('weekbegin'))));       $AppsTestskedUsers->entered=date('Y-m-d');                     $success='Test was successfully added!';              if($AppsTestskedUsers->save()) {          return redirect('/admin/rltest/summary');       }     }     /**      * Display the specified resource.      *      * @param  int  $id      * @return \Illuminate\Http\Response      */     public function list($testid = 0)     {       $data = array();       if($testid == 0){           $all_tests   = AppsTestskedUsers::sortable()->orderBy('weekopen', 'DESC')->get();                } else{                    $all_tests   = AppsTestskedUsers::sortable()->where('testnum',$testid)->orderBy('weekopen', 'DESC')->get();       }       $test_name = "All Testing Appointments";       if($testid == '2') $test_name = "Testing Appointments For Reliability Test #2";       if($testid == '3') $test_name = "Testing Appointments For Reliability Test #3";       if($testid == '4') $test_name = "Testing Appointments For Re-Licensing Test #1";       if($testid == '5') $test_name = "Testing Appointments For Re-Licensing Test #2";       foreach($all_tests as $tests){          $id        = $tests->id;             $name       = $tests->name;             $testnum    = $tests->testnum;             $email      = $tests->email;                      $weekopen   = ($tests->weekopen == '0000-00-00' || empty($tests->weekopen)) ? "" : date("m/d/Y",strtotime($tests->weekopen));           $winopen    = ($tests->winopen == '0000-00-00' || empty($tests->winopen)) ? "NOT STARTED" : date("m/d/Y",strtotime($tests->winopen));          $winclose   = ($tests->winclose == '0000-00-00' || empty($tests->winclose)) ? "NOT FINISHED" : date("m/d/Y",strtotime($tests->winclose));                                        $testsummaries[] = array('id' =>$id,'name' =>$name,'email' =>$email,'weekopen' =>$weekopen,'winopen' =>$winopen,'winclose' =>$winclose);                 }       $data['test_num'] = $testid;       $data['test_name'] = $test_name;       $data['testsummaries'] = $testsummaries;       return view('admin/listRltest', compact('data'));            }         public function showOrder($id)     {         //       $pro = CeuOrder::findOrFail($id);       return view('admin/showOrder', compact('pro'));            }     /**      * Show the form for editing the specified resource.      *      * @param  int  $id      * @return \Illuminate\Http\Response      */     public function edit($id)     {             $test   = AppsTestskedUsers::sortable()->where('id',$id)->first();       /* echo "<pre>";print_r($test);die;  */         return view('admin/editRltest', compact('test'));     }     /**      * Update the specified resource in storage.      *      * @param  \Illuminate\Http\Request  $request      * @param  int  $id      * @return \Illuminate\Http\Response      */     public function update(UpdateRltestRequest $request)     {         //       $validated = $request->validated();       $AppsTestskedUsers = AppsTestskedUsers::findOrFail($request->input('id'));       $AppsTestskedUsers->name=$request->input('name');       $AppsTestskedUsers->email=$request->input('email');       $AppsTestskedUsers->testnum=$request->input('testnum');       $AppsTestskedUsers->ordernum=$request->input('ordernum');       $AppsTestskedUsers->weekopen=$request->input('weekopen');       $AppsTestskedUsers->weekopen=$request->input('weekclose');       $AppsTestskedUsers->winopen=$request->input('winopen');       $AppsTestskedUsers->winclose=$request->input('winclose');                     $success='Test was successfully updated!';              if($AppsTestskedUsers->save()) {          return redirect('/admin/rltest/edit/'.$request->id);       }     }     /**      * Remove the specified resource from storage.      *      * @param  int  $id      * @return \Illuminate\Http\Response      */     public function destroy(DeleteRltestRequest $request)     {         //       $i = 0;       foreach($request->input('ids') as $val) {          $AppsTestskedUsers = AppsTestskedUsers::findOrFail($val);          $AppsTestskedUsers->delete();          $i++;        }       Session::flash('message', $i.' Record successfully deleted.');       return redirect('/admin/rltest/list/'.$request->input('test_num'));     } }

Open in new window

...and here are my routes:

<?php
/* |-------------------------------------------------------------------------- | Web Routes |-------------------------------------------------------------------------- | | Here is where you can register web routes for your application. These | routes are loaded by the RouteServiceProvider within a group which | contains the "web" middleware group. Now create something great! | */ use App\Mail\EventRequest; use Illuminate\Support\Facades\Mail; Auth::routes(); Route::get('/', 'PublicController@index')->name('index'); Route::get('/page/{id}', 'PublicController@page')->name('page'); Route::get('/professionals/{id}', 'PublicController@professionals')->name('pros'); Route::get('/professionalsUSA/{id}', 'PublicController@professionalsUSA')->name('prosUSA'); Route::get('/professionalsWorld/{id}', 'PublicController@professionalsWorld')->name('prosWorld'); Route::get('/permission','PublicController@permission')->name('permission'); Route::get('/testimonials','PublicController@testimonials')->name('testimonials'); Route::get('/testimonial_solo/{id}', 'PublicController@testimonial_solo')->name('testimonial_solo'); Route::get('/events','PublicController@events')->name('events'); Route::get('/events_solo/{id}', 'PublicController@events_solo')->name('event_solo'); Route::get('/event_info/{id}', 'PublicController@events_info')->name('event_info'); Route::post('event_info', 'PublicController@events_request')->name('event_email'); Route::get('/event_confirm', 'PublicController@events_confirm')->name('event_confirm'); Route::post('conference_info', 'PublicController@conference_info')->name('conference_info'); Route::get('/conference_request', 'PublicController@conference_request')->name('conference_request'); Route::get('/contact', 'PublicController@contact')->name('contact_form'); Route::post('/contact_processor', 'PublicController@contact_processor')->name('contact_processor'); Route::get('training', 'PublicController@training')->name('training'); Route::prefix('admin')->group(function() {     Route::get('/dashboard', 'AdminController@dashboard')->name('adminDashboard');         Route::get('/list/user', 'UserController@index')->name('adminListUsers');    Route::get('/insert/user', 'UserController@insertUser')->name('adminUserInsert');    Route::post('/create/user', 'UserController@store')->name('adminStoreUser');    Route::get('/show/user/{id}', 'UserController@show')->name('adminShowUser');    Route::post('/update/user', 'UserController@update')->name('adminUpdateUser');    Route::post('/delete/user/{id}', 'UserController@destroy')->name('adminDeleteUser');         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');    Route::get('/list/professional', 'ProfessionalController@index')->name('adminListProfessionals');    Route::get('/insert/professional', 'ProfessionalController@create')->name('adminProfessionalInsert');    Route::post('/store/professional', 'ProfessionalController@store')->name('adminStoreProfessional');    Route::get('/show/professional/{id}', 'ProfessionalController@show')->name('adminShowProfessional');    Route::post('/update/professional', 'ProfessionalController@update')->name('adminUpdateProfessional');    Route::post('/delete/professional/{id}', 'ProfessionalController@destroy')->name('adminDeleteProfessional');          Route::get('/list/customer', 'CustomerController@index')->name('adminListCustomers');    Route::get('/insert/customer', 'CustomerController@create')->name('adminCustomerInsert');    Route::post('/store/customer', 'CustomerController@store')->name('adminStoreCustomer');    Route::get('/show/customer/{id}', 'CustomerController@show')->name('adminShowCustomer');    Route::post('/update/customer', 'CustomerController@update')->name('adminUpdateCustomer');    Route::post('/delete/customer/{id}', 'CustomerController@destroy')->name('adminDeleteCustomer');                 Route::get('/rltest/insert', 'RltestController@create')->name('adminRltestInsert');          Route::get('/rltest/summary', 'RltestController@index')->name('adminRltestSummary');    Route::post('/store/rltest', 'RltestController@store')->name('adminStoreRltest');    Route::post('/update/rltest', 'RltestController@update')->name('adminUpdateRltest');    Route::post('/delete/rltest', 'RltestController@destroy')->name('adminDeleteRltest');    Route::get('/rltest/list/{id}', 'RltestController@list')->name('adminRltestList');    Route::get('/rltest/edit/{id}', 'RltestController@edit')->name('adminRltestEdit');    Route::get('/rltest/list', 'RltestController@list')->name('adminRltestList');        Route::get('/list/page', 'PageController@index')->name('adminListPages');    Route::get('/insert/page', 'PageController@insertPage')->name('adminInsertPage');    Route::get('/show/page/{id}', 'PageController@show')->name('adminShowPage');    Route::post('/edit/page', 'PageController@edit')->name('adminEditPage');    Route::post('/create/page', 'PageController@store')->name('adminStorePage');    Route::post('/update/page', 'PageController@update')->name('adminUpdatePage');       Route::post('/delete/page/{id}', 'PageController@destroy')->name('adminDeletePage');           Route::get('/list/video', 'VideoController@index')->name('adminListVideos');    Route::get('/insert/video', 'VideoController@create')->name('adminVideoInsert');    Route::post('/store/video', 'VideoController@store')->name('adminStoreVideo');    Route::get('/show/video/{id}', 'VideoController@show')->name('adminShowVideo');    Route::post('/update/video', 'VideoController@update')->name('adminUpdateVideo');    Route::post('/delete/video/{id}', 'VideoController@destroy')->name('adminDeleteVideo');    Route::get('/list/testimonial', 'TestimonialController@index')->name('adminListTestimonials');    Route::get('/insert/testimonial', 'TestimonialController@insertTestimonial')->name('adminTestimonialInsert');    Route::post('/store/testimonial', 'TestimonialController@store')->name('adminStoreTestimonial');    Route::get('/show/testimonial/{id}', 'TestimonialController@show')->name('adminShowTestimonial');    Route::post('/update/testimonial', 'TestimonialController@update')->name('adminUpdateTestimonial');    Route::post('/delete/testimonial/{id}', 'TestimonialController@destroy')->name('adminDeleteTestimonial');       Route::get('/list/calendar', 'CalendarController@index')->name('adminListCalendar');    Route::get('/insert/calendar', 'CalendarController@insertCalendar')->name('adminInsertCalendar');    Route::get('/show/calendar/{id}', 'CalendarController@show')->name('adminShowCalendar');    Route::post('/edit/calendar', 'CalendarController@edit')->name('adminEditCalendar');    Route::post('/create/calendar', 'CalendarController@store')->name('adminStoreCalendar');    Route::post('/update/calendar', 'CalendarController@update')->name('adminUpdateCalendar');       Route::post('/delete/calendar/{id}', 'CalendarController@destroy')->name('adminDeleteCalendar');       Route::get('/list/category', 'CategoryController@index')->name('adminListCategories');    Route::get('/insert/category', 'CategoryController@insertcategory')->name('adminInsertCategory');    Route::get('/show/category/{id}', 'CategoryController@show')->name('adminShowCategory');    Route::post('/edit/category', 'CategoryController@edit')->name('adminEditCategory');    Route::post('/create/category', 'CategoryController@store')->name('adminStoreCategory');    Route::post('/update/category', 'CategoryController@update')->name('adminUpdateCategory');       Route::post('/delete/category/{id}', 'CategoryController@destroy')->name('adminDeleteCategory');           Route::get('/list/order', 'CustomerController@listOrders')->name('adminListOrders');    Route::get('/insert/order', 'CustomerController@insertorder')->name('adminInsertOrder');    Route::get('/show/order/{id}', 'CustomerController@showOrder')->name('adminShowOrder');    Route::post('/edit/order', 'orderController@edit')->name('adminEditOrder');    Route::post('/create/order', 'CustomerController@store')->name('adminCreateOrder');    Route::post('/update/order', 'orderController@update')->name('adminUpdateOrder');       Route::post('/delete/order/{id}', 'orderController@destroy')->name('adminDeleteOrder');     Route::get('/list/practice_videos', 'PracticeVideosController@index')->name('adminListPracticeVideos');     Route::get('/assign/practice_video', 'PracticeVideosController@create')->name('adminPracticeVideoInsert');     Route::post('/store/practice_video', 'PracticeVideosController@store')->name('adminStorePracticeVideo');     Route::get('/show/practice_video/{id}', 'PracticeVideosController@show')->name('adminShowPracticeVideo');     Route::post('/update/practice_video', 'PracticeVideosController@update')->name('adminUpdatePracticeVideo');     Route::post('/delete/practice_video/{id}', 'PracticeVideosController@destroy')->name('adminDeletePracticeVideo');     Route::get('/practice_video/{id}', 'CeuProductController@practice_video')->name('ceuPracticeVideoAdmin'); }); Route::prefix('user')->group(function() {    Route::get('/home', 'HomeController@index')->name('userDashboard'); }); Route::prefix('olceu')->group(function() {    Route::get('/login', 'CeuUserController@login')->name('ceuUserLogin');    Route::post('/authenticate', 'CeuUserController@authenticate')->name('ceuUserAuthenticate');    Route::get('/apptestskedlogin', 'CeuUserController@apptestskedlogin')->name('ceuUserApptestskedLogin');    Route::post('/apptestskedauthenticate', 'CeuUserController@apptestskedauthenticate')->name('ceuUserApptestskedAuthenticate');    Route::group(['middleware'=>'apps_testsked_users'], function() {       Route::get('/apptestskeddashboard/{ordernum?}', 'CeuUserController@apptestskeddashboard')->name('ceuUserApptestskedDashboard');       Route::post('/apptestskedlogout', 'CeuUserController@apptestskedlogout')->name('ceuUserApptestskedLogout');    });       Route::group(['middleware'=>'ceu_user'], function() {       Route::get('/dashboard/{sid?}/{orderno?}', 'CeuUserController@dashboard')->name('ceuUserDashboard');       Route::post('/logout', 'CeuUserController@logout')->name('ceuUserLogout');       /* User Handouts/PDFs */       Route::get('/pdf/{id}', 'CeuProductController@pdf')->name('ceuProductPdf');       /* User Videos */       Route::get('/practice_video/{id}', 'CeuProductController@practice_video')->name('ceuPracticeVideo');       Route::get('/video/{id}', 'CeuProductController@video')->name('ceuProductVideo');       Route::get('/video/series/four/{part}/{the_sid}/{the_at}', 'CeuProductController@seriesFourVideo')->name('ceuProductSeriesFourVideoWithPart');       Route::get('/video/series/four/{the_sid}/{the_at}', 'CeuProductController@seriesFourVideo')->name('ceuProductSeriesFourVideo');       Route::get('/video/fetch/{filename}', function ($filename)       {          $path = storage_path('app/olceu/videos/' . $filename);                    if (!File::exists($path)) {             abort(404);          }          $file = File::get($path);          $type = File::mimeType($path);          $response = Response::make($file, 200);          $response->header("Content-Type", $type);          return $response;       })->name('ceuProductFetchVideo');       /* User Quizzes */       Route::get('/quiz/{id}/{sid}/{qt}/{at}', 'CeuQuizController@userQuiz')->name('ceuUserQuizAllParams');       Route::get('/quiz/{id}/{sid}/{qt}', 'CeuQuizController@userQuiz')->name('ceuUserQuizWithSid');       Route::get('/quiz/{id}/{qt}/{at}', 'CeuQuizController@userQuiz')->name('ceuUserQuizWithAt');       Route::get('/quiz/{id}/{qt}', 'CeuQuizController@userQuiz')->name('ceuUserQuizNoParams');       Route::post('/quiz', 'CeuQuizController@userAttemptQuiz')->name('ceuUserAttemptQuiz');    });    });   

Open in new window

It's the "weekopen" field that's not being updated and I don't know why.


What am I missing and is there a way in which you can pop the hood on all this with either an "echo" or a "print" where you can see the query in action?


Thanks!

Avatar of ste5an
ste5an
Flag of Germany image

You're using weekopen and weekbegin in your code..
Avatar of Bruce Gust

ASKER

ste5an, while I have you on the phone, is there a way within Laravel that you can print the query that's being run?
Never done it, but this should do it:

use Illuminate\Support\Facades\DB;
 
public function UserController()
{
    DB::enableQueryLog();
    $arr_user = DB::table('users')->select('name', 'email as user_email')->get();
    dd(DB::getQueryLog());
}

Open in new window

And ste5an, let me run this by you because I want to make sure.

You're thinking that the incoming information for "weekopen" is incorrectly labeled as "winbegin."

Here's the blade:

<div class="row">
                        <div class="col-md-6 col-xs-12">
                           <label for="weekbegin">Week Begins:</label>
                           <input data-provide="datepicker" data-date-format="yyyy-mm-dd" name="weekopen" id="datepicker0" type="text" value="{{ $test->weekopen }}" size="30" maxlength="10" class="form-control" autocomplete="123">
                           <div class='caption'>Click date for pop-up calendar. This date starts the 7-day availability period.<br>Manual entry must be formatted "yyyy-mm-dd".</div>
                              
                        </div>

Open in new window

...and here's the Controller:

  public function update(UpdateRltestRequest $request)
    {
        //
      $validated = $request->validated();
      $AppsTestskedUsers = AppsTestskedUsers::findOrFail($request->input('id'));
      $AppsTestskedUsers->name=$request->input('name');
      $AppsTestskedUsers->email=$request->input('email');
      $AppsTestskedUsers->testnum=$request->input('testnum');
      $AppsTestskedUsers->ordernum=$request->input('ordernum');
      $AppsTestskedUsers->weekopen=$request->input('weekopen');
      $AppsTestskedUsers->weekopen=$request->input('weekclose');
      $AppsTestskedUsers->winopen=$request->input('winopen');
      $AppsTestskedUsers->winclose=$request->input('winclose');
      
      
      $success='Test was successfully updated!';
      
      if($AppsTestskedUsers->save()) {
         return redirect('/admin/rltest/edit/'.$request->id);
      }
    }

Open in new window

The nameof the problematic field is...
 name="weekopen" 

Open in new window

...although the label is...
<label for="weekbegin">Week Begins:</label>

Open in new window

Is the label the the thing that the code is defaulting to? I would've thought it was the name of the field. I haven't even tried it yet, but I figured I would ask.
ASKER CERTIFIED SOLUTION
Avatar of ste5an
ste5an
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I just changed the label to "weekopen" and nothing changed. I made the change on the blade...
I see what you're saying.

Actually lines #10 and #11 in the Controller (what I have posted) look pretty bogus too.

Stand by...
ste5an, I'm looking up "storage" based on what I see where it says, "Update the specified resource in storage..."

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(UpdateRltestRequest $request)
    {
        //
      $validated = $request->validated();
      $AppsTestskedUsers = AppsTestskedUsers::findOrFail($request->input('id'));
      $AppsTestskedUsers->name=$request->input('name');
      $AppsTestskedUsers->email=$request->input('email');
      $AppsTestskedUsers->testnum=$request->input('testnum');
      $AppsTestskedUsers->ordernum=$request->input('ordernum');
      $AppsTestskedUsers->weekopen=$request->input('weekopen');
      $AppsTestskedUsers->weekopen=$request->input('weekclose');
      $AppsTestskedUsers->winopen=$request->input('winopen');
      $AppsTestskedUsers->winclose=$request->input('winclose');
     
     
      $success='Test was successfully updated!';
     
      if($AppsTestskedUsers->save()) {
         return redirect('/admin/rltest/edit/'.$request->id);
      }
    }

...and even after making the change on line #77, any edit to "weekopen" didn't change anything.

But...

$AppsTestskedUsers->weekopen=$request->input('weekopen');
$AppsTestskedUsers->weekopen=$request->input('weekclose');

When I incorporated your suggestions and changed the above two lines to this:

$AppsTestskedUsers->weekopen=$request->input('weekopen');
$AppsTestskedUsers->weekclose=$request->input('weekclose');

...it worked!

Thanks!

I'm shutting the question down, ste5an, but if you could elaborate at all on what "storage" is, I would appreciate it.

Thanks!