Created
February 25, 2019 13:07
-
-
Save Neoglyph/e4b31a8d8c3e70263712f98a911aa138 to your computer and use it in GitHub Desktop.
Laravel Model Events
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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