oodin53
change view dynamically in a page
Hello,
I've made a page in which I'd like to have tabs.
When I click on a tab, I want to load a different component in my page.
Is it possible to load different component on live like @livewire('components.'.$componentName) ?
4 replies
Problem to attach on relationManager
Hello,
I have a problem attaching one model to another with the relationmanager.
This is my model :
class Competition extends Model
{
public function squads()
{
return $this->belongsToMany(Squad::class)->join('clubs', 'club_id', '=', 'clubs.id')->orderBy('clubs.name');
}
}
class Squad extends Model
{
public function club()
{
return $this->belongsTo(Club::class);
}
}
I have a RelationManager :
class SquadsRelationManager extends RelationManager
{
protected static string $relationship = 'squads';
protected static ?string $recordTitleAttribute = 'clubs.name';
public function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('club.name'),
])
}
}
The club names are displayed correctly on the competition edit page, but when I want to associate a new club, I do a search in the club name list, and I get an error "Undefined property: stdClass::$name".
I don't know which "name" property is causing the problem.
Is it possible to add it like I did? I'm just starting out with Filament.
Thanks for your help.
(sorry for my english)21 replies