F
Filament13mo ago
ouch

Many to Many in Tables in livewire component

Hey guys I'm newbie in filament and livewire and I'm confused with relationships. I have filament tables as stand alone package on livewire without panel, and i have a problem with many to many relationship Order >--< Status, and I want to use SelectColumn. And I'm confused how to make it work. Because i dont use panel so i can't create realation ship manager correct? Model Order
public function statuses(): BelongsToMany
{
return $this->belongsToMany(
Status::class,
'order_status',
'order_id',
'status_id'
)->withTimestamps();
}
public function statuses(): BelongsToMany
{
return $this->belongsToMany(
Status::class,
'order_status',
'order_id',
'status_id'
)->withTimestamps();
}
Inside table - I know that it does not get last element but honestly I'm lost now.
SelectColumn::make('statuses.name')
->label('Stav')
->options(Status::pluck('name')
->toArray())
SelectColumn::make('statuses.name')
->label('Stav')
->options(Status::pluck('name')
->toArray())
1 Reply
Vp
Vp13mo ago
I don't think SelectColumn support many-many relationship
Because i dont use panel so i can't create realation ship manager correct?
You cannot use the panel relation manager but you can create a table, query the relationship data.. and it's same as relation manager.. And one advice tho, create table action, and inside the action you call a form to update status..
Want results from more Discord servers?
Add your server