I think that I was thinking about it the wrong way.
I think something like this should work in my EloquentFormRepository
:
public function addField($field, $label, $is_required)
{
$field = $this->field->where('name', $field)->first();
return $this->form->fields()->attach($field->id);
// TODO: Add pivot data $label and $is_required
}
public function deleteField($field)
{
$field = $this->field->where('name', $field)->first();
return $this->form->fields()->detach($field->id);
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community