MedicOneSystems / MedicOneSystems/livewire-datatables

Problems with many to many tables

Open
#327 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
1.2k
Forks
257
PR merge metrics
No merged PRs in 30d

Description

my client wanted me to make a filter for product classes but I have a weird problem

I notice that in your demo for complex examples you have weapons

that has model and it seem to work
public function weapons() { return $this->belongsToMany(Weapon::class); }

but my version that to tough two levels joborder -> orders -> product
JobOrder model:
public function order() { return $this->belongsTo('App\Models\Order', 'order_id'); }
Order Model:
public function products() { return $this->belongsToMany(Product::class)->withPivot('qty'); }

then this livewire datatable code where I am calling it

image

but I get this error and it weird one to many seem work fine but many to many and does not know what to do with it
image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository files or tests are named. Start by reproducing the error from the JobOrder and Order model relationships and the Livewire datatable call shown in the issue, then inspect how relationship paths are resolved. Done means the expected many-to-many traversal behavior is established and the reported error is either fixed or clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
laravel, php
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.