Duplicate User I'd Names
Example: I have Users Table. There are Patients, Doctors and all other users in it based on role user table.
I have an Appointment Table. Where patient_id, doctor_id these forign_ids belongs to User Table.
When I create a Livewire Datatable I am having issue Retrieving the Data When It is duplication the username on Doctor Name if Patient Name is given First.
If I Check the Direct Query Data.
It is working perfectly.
Don't Know Whet the Issue is, Please Check.
LiveWire Table Code: `public $model = OpdPatient::class; public $exportable = true;
public function builder()
{
return OpdPatient::query();
}
public function columns()
{
return [
Column::checkbox()
->label('Checkbox'),
Column::index($this)
->unsortable(),
Column::name('patient.name')
->searchable()
->label('Patient Name')
->filterable(),
DateColumn::name('date')
->searchable()
->filterable(),
TimeColumn::name('time')
->searchable()
->filterable(),
Column::name('doctor.name')
->searchable()
->label('Doctor Name')
->filterable(),
Column::name('description')
->searchable()
->truncate(50)
->filterable(),
Column::callback(['id'], function ($id) {
return view('backend.pages.opd-patients.actions', ['id' => $id]);
})->excludeFromExport()->unsortable()->label('Action'),
];
}`
Model Code: `protected $fillable = [ 'patient_id', 'doctor_id', 'date', 'time', 'description', ];
public function patient()
{
return $this->belongsTo(User::class, 'patient_id');
}
public function doctor()
{
return $this->belongsTo(User::class, 'doctor_id');
}`
Table Screen Shot:

Edit Screen Shot:

Please Help Me Out...
@tomshaw @andruu
Can You Please Look into it
Closed as using Filament