laravel-admin icon indicating copy to clipboard operation
laravel-admin copied to clipboard

I have a nested one-to-many table so as the nested table has many-to-many relation with categories table.

Open kash26 opened this issue 2 years ago • 1 comments

I want to save or edit this nested table with the pivot table but I can not access the pivot because the Laravel-admin can not see the pivot table, it just sees the nested table and see the model method as nested table field.

THAT IS MY SIMPLIFIED MAIN AN DNESTED TABLE

protected function form() { $form = new Form(new Juridique()); $form3 = new Form(new Physique());

    $form->multipleSelect('categories', 'Les catégories')->options(Categorie::all()->pluck('titre', 'id'));

    $form->hasMany('physiques', 'Physiques', function (Form\NestedForm $form2) {
        $form2->text('nom', __('Nom'));
        $form2->multipleSelect('categories', 'Categorie')->options(Categorie::all()->pluck('titre', 'id'));
    });


    return $form;
}

THAT IS MY SIMPLIFIED NESTED MODEL class Physique extends Model { use HasFactory, DefaultDatetimeFormat;

protected $table = 'physiques';
public function categories()
{
    // return $this->belongsToMany(Categorie::class);
    return $this->belongsToMany(Categorie::class, 'categorie_physique', 'physique_id', 'categorie_id');
}

}

  • Laravel Version: #.#.#
  • PHP Version:
  • Laravel-admin: #.#.#

Description:

Steps To Reproduce:

kash26 avatar Mar 18 '22 14:03 kash26

Same issue here

ArturoTorresMartinez avatar Jun 08 '22 23:06 ArturoTorresMartinez