mardi 21 juin 2016

Laravel Input::all() fetching one row only

I have a form with a table example

Name | Review | Rating | Status

This table may have multiple rows and only Status is editable which is a dropdown field

I am able to show all the data, But when I save using code below,I notice that dd is only showing one row. When I save , one row is saved and then an error is displayed. Error:

ErrorException in DashBoardController.php line 432: Creating default object from empty value

where line number 432 is : $approved_reviews->approved= $status1

Below is my code snippet. Please help.

 $approve_reviews = Input::except('_token');          

              foreach ($approve_reviews as $review_id) {
               $approved_reviews = dealer_reviews::where('id',$review_id )->first();
              $status1 = Input::get('status');
              $approved_reviews->approved= $status1;

                    $approved_reviews->save();

             }

I have also tried Input::all(), but dd shows just one row.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire