class ExampleUserService
{
public function approve($user, $data)
{
$approvedUser = DB::transaction(function () use ($user, $data) {
if ($data['approve_by_admin'] == 1) {
$this->updateAdminStatus($user);
}
$user->update(['approved' => 1]); // This fires updated event
});
}
public function updateAdminStatus($user, $data)
{
$user = DB::transaction(function () use ($user, $data) {
//Some Logic
$user->update(['status' => 5]); // This doesn't fire event
});
}
}
I have Scenario like above where same model gets updated in nested transactions but observer get only changes of last transaction, i want to get all updates in observer for same model.