When no data is changed then laravel checks for isDirty and never executed the update query and hence model updated event is not fired. How can we manually trigger an event?
            Asked
            
        
        
            Active
            
        
            Viewed 7,796 times
        
    1 Answers
9
            To manually trigger an event
$user = User::findOrFail($id);
$user->fill($data);
$user->save();
event('eloquent.updated: App\User', $user);
 
    
    
        Jagadesha NH
        
- 2,529
- 2
- 23
- 41
- 
                    That would trigger the observer twice. – Sylar Feb 25 '22 at 14:54
- 
                    Can I ask, which version of laravel is this. any response will be appreciated. – Jovylle Jun 14 '22 at 15:17
- 
                    @Jovylle I'm not sure if it helps, but I can confirm it works on Laravel 8.83.9 – Techno Sep 14 '22 at 12:57