app/Containers/Farmer/Models/Farmer.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->plots as $plot) {
                $plot->delete();
            }
            optional($element->photo)->deleteMedia();
        });
    }
public static function boot ( ) { parent :: boot ( ) ; static :: deleting ( function ( $ element ) { foreach ( $ element -> plots as $ plot ) { $ plot -> delete ( ) ; } optional ( $ element -> photo ) -> deleteMedia ( ) ; } ) ; }
use delete event to delete subentities
use delete event to delete subentities
//plots //photo