MedicOneSystems / MedicOneSystems/livewire-datatables

editable on relations with other models

Open
#300 0 comments 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

When trying to edit a field which is on relation with other model you get error
query

return Users::query()
            ->with(['Subusers', 'Servers'])
            ->where('id', $this->params);

and the return from columns()

            Column::name('Subusers.type')->label('Type')->filterable()**->editable()**->searchable(),

and as result

SQLSTATE[42S22]: Column not found: 1054 Unknown column name in field list (SQL: update users set type = Test where id = 1)

I hope I got that error as an Issue if not my apologize and delete it 😃

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

Start by reproducing the Users query with the Subusers and Servers relations, then trace how the Column::name('Subusers.type') definition reaches the update operation. Determine the expected behavior for editing a related field and verify that the resulting SQL updates the appropriate relation rather than users.type.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.