protected function deleteModels(): void
    {
        $model = app($this->modelClass);
        // determine if the model uses `SoftDeletes` trait
        $usesSoftDeletes = in_array(SoftDeletes::class, class_uses($model));

        foreach ($model->all() as $value) {
            try {
                if ($usesSoftDeletes) {
                    $value->forceDelete();
                } else {
                    $value->delete();
                }
            } catch (Exception $exception) {
                Log::warning(sprintf('Error during deleting models. Table: %s. Error: %s', $model->getTable(), $exception->getMessage()));
            }
        }
    }
protected function deleteModels(): void
    {
        $model = app($this->modelClass);
        // determine if the model uses `SoftDeletes` trait
        $usesSoftDeletes = in_array(SoftDeletes::class, class_uses($model));

        foreach ($model->all() as $value) {
            try {
                if ($usesSoftDeletes) {
                    $value->forceDelete();
                } else {
                    $value->delete();
                }
            } catch (Exception $exception) {
                Log::warning(sprintf('Error during deleting models. Table: %s. Error: %s', $model->getTable(), $exception->getMessage()));
            }
        }
    }
protected function deleteModels ( ) : void { $ model = app ( $ this -> modelClass ) ; // determine if the model uses `SoftDeletes` trait $ usesSoftDeletes = in_array ( SoftDeletes :: class , class_uses ( $ model ) ) ; foreach ( $ model -> all ( ) as $ value ) { try { if ( $ usesSoftDeletes ) { $ value -> forceDelete ( ) ; } else { $ value -> delete ( ) ; } } catch ( Exception $ exception ) { Log :: warning ( sprintf ( 'Error during deleting models. Table: %s. Error: %s' , $ model -> getTable ( ) , $ exception -> getMessage ( ) ) ) ; } } }
Removes all existing models.

@throws Exception
Removes all existing models .