does not updating database fields in laravel
into model
public function updateSport($sportDetail){
updateorCrate
}
when updating it should update because I'm getting the new records into console but it does not allow to update the fields i don't know why please suggest where i am mistaking. Thanks in advance
Call a new instance of the UserSport model for each iteration.
foreach ($sports as $sportDetail) {
$sportsModel = UserSport::firstOrNew(array('user_id' => $sportDetail['user_id'], 'sport_id' => $sportDetail['sport_id'] ));
$sportsModel->position_id = $sportDetail['position_id'];
$sportsModel->shot = (isset($sportDetail['shot'])) ? $sportDetail['shot'] : '';
.
.
.
.
$sportsModel->save();
}