Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Laravel 5.5 boot() in model
public static function boot()
{
parent::boot();
self::deleting(function($model) {
if($model->default == 1)
return false;
});
self::updated(function($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
You can’t perform that action at this time.