Support the ongoing development of Laravel.io →
posted 10 years ago
Eloquent
Last updated 2 years ago.
0

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);
    }

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.