So I got it working, but I now know the problem is in the Builder query that's in the relationship.
Here's my current code:
Section::make('Stadijas')
->schema([
Wizard::make([
...$stages->map(function (ProjectStage $stage) {
return Wizard\Step::make($stage->name)
->schema([
Repeater::make("projectSubpoints")
->relationship('projectSubpoints', fn(Builder $query) => $query->whereHas('projectStageSubpoint', function (?Builder $query) use ($stage) {
$query?->where('project_stage_id', $stage->id);
}))
->schema([
Placeholder::make('Nosaukums')
->content(fn(?ProjectSubpoint $record) => $record?->projectStageSubpoint()?->first()?->name)
->label($stage->name),
Placeholder::make('Test')
->content(fn() => $stage->id),
Toggle::make('visible'),
Toggle::make('status'),
])->columns(3)
->addable(false)
->deletable(false)
->reorderableWithDragAndDrop(false)
->orderColumn('order_column')
]);
})
])
])
->visible(fn(?Project $record) => $record?->has_bis_lieta)
The thing is that when I put a static number like 1,2,3,4 in $stage->id, it works. But if it's using the variable I'm looping through, it just shows the last one (7 in my case).
Viewing the $stage->id inside the form changes it when hopping through the steps. Is this some kind of Livewire mismatch issue or what?