app/Containers/Nursery/Models/Nursery.php
/**
     * use delete event to delete subentities
     */
use delete event to delete subentities
use delete event to delete subentities
public static function boot()
    {
        parent::boot();
        static::deleting(function($element) {
            foreach ($element->surveys as $survey) {
                $survey->delete();
            }
            foreach ($element->album as $media) $media->deleteMedia();
            optional($element->polygon)->delete();
            optional($element->point)->delete();
        });
    }
public static function boot ( ) { parent :: boot ( ) ; static :: deleting ( function ( $ element ) { foreach ( $ element -> surveys as $ survey ) { $ survey -> delete ( ) ; } foreach ( $ element -> album as $ media ) $ media -> deleteMedia ( ) ; optional ( $ element -> polygon ) -> delete ( ) ; optional ( $ element -> point ) -> delete ( ) ; } ) ; }
use delete event to delete subentities
use delete event to delete subentities
//surveys //album media //polygon //point