Skip to content

Instantly share code, notes, and snippets.

@Neoglyph
Created February 25, 2019 13:07
Show Gist options
  • Save Neoglyph/e4b31a8d8c3e70263712f98a911aa138 to your computer and use it in GitHub Desktop.
Save Neoglyph/e4b31a8d8c3e70263712f98a911aa138 to your computer and use it in GitHub Desktop.
Laravel Model Events
class User extends Model
{
public static function boot()
{
parent::boot();
self::creating(function($model){
// ... code here
});
self::created(function($model){
// ... code here
});
self::updating(function($model){
// ... code here
});
self::updated(function($model){
// ... code here
});
self::deleting(function($model){
// ... code here
});
self::deleted(function($model){
// ... code here
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment