F
Filament11mo ago
Masea

Updating another column if a column was dirty using observer results in stack overflow

public function saveProfile(): void
{
$this->user->update(
$this->profileForm->getState(),
);
}
public function saveProfile(): void
{
$this->user->update(
$this->profileForm->getState(),
);
}
This is my submit function of the form.
public function updated(User $user)
{
if ($user->isDirty('username')) {
$user->update([
'username_changed_at' => now()
]);
}
}
public function updated(User $user)
{
if ($user->isDirty('username')) {
$user->update([
'username_changed_at' => now()
]);
}
}
and this is the observer. When I submit the form, it goes into a infinite loop, idk why. Any idea to solve this? Thanks
0 Replies
No replies yetBe the first to reply to this messageJoin