public function challenges()
{
return $this->belongsToMany(Challenge::class, 'role_challenge', 'role_id', 'challenge_id');
}
public function participant()
{
return $this->challenges()->where('is_participant','=',TRUE)
->where('is_watcher','=',TRUE);
}
And this is my database table
So basically when user choose a challenge (test1, test2, test3) to participant field I want to change is_participant value to 1 in database if it is not exist will add new line with is_participant value is 1.
I can add new line when I choose (test1, test2,test3) but I cannot change column values.
Hi, I let user to choose participation values from panel. Depending on selection I have to change columns is_participant to 1
this is my field on AdminPanel
This is my model file
And this is my database table
So basically when user choose a challenge (test1, test2, test3) to participant field I want to change is_participant value to 1 in database if it is not exist will add new line with is_participant value is 1.
I can add new line when I choose (test1, test2,test3) but I cannot change column values.
thank you