public static function boot()
    {
        parent::boot();

        // Delete hierarchies first.
        static::deleting(function($model)
        {
            $model->children()->detach();

            $model->parents()->detach();
        });
    }
public static function boot()
    {
        parent::boot();

        // Delete hierarchies first.
        static::deleting(function($model)
        {
            $model->children()->detach();

            $model->parents()->detach();
        });
    }
public static function boot ( ) { parent :: boot ( ) ; // Delete hierarchies first. static :: deleting ( function ( $ model ) { $ model -> children ( ) -> detach ( ) ; $ model -> parents ( ) -> detach ( ) ; } ) ; }
Model event.

@return void
Model event .