MedicOneSystems / MedicOneSystems/livewire-datatables
Problems with many to many tables
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

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

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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