common/services/resources/FileService.php
public function delete( $model, $config = [] ) {

		$admin = isset( $config[ 'admin' ] ) ? $config[ 'admin' ] : false;

		if( isset( $model ) ) {

			// Only admin is authorised to delete a shared file using file browser.
			if( $admin || !$model->shared ) {

				// Delete mappings
				Yii::$app->factory->get( 'modelFileService' )->deleteByModelId( $model->id );

				// Delete from disk
				$model->clearDisk();

				// Delete model
				return parent::delete( $model, $config );
			}
		}

		return false;
	}
public function delete( $model, $config = [] ) {

		$admin = isset( $config[ 'admin' ] ) ? $config[ 'admin' ] : false;

		if( isset( $model ) ) {

			// Only admin is authorised to delete a shared file using file browser.
			if( $admin || !$model->shared ) {

				// Delete mappings
				Yii::$app->factory->get( 'modelFileService' )->deleteByModelId( $model->id );

				// Delete from disk
				$model->clearDisk();

				// Delete model
				return parent::delete( $model, $config );
			}
		}

		return false;
	}
public function delete ( $ model , $ config = [ ] ) { $ admin = isset ( $ config [ 'admin' ] ) ? $ config [ 'admin' ] : false ; if ( isset ( $ model ) ) { // Only admin is authorised to delete a shared file using file browser. if ( $ admin || ! $ model -> shared ) { // Delete mappings Yii :: $ app -> factory -> get ( 'modelFileService' ) -> deleteByModelId ( $ model -> id ) ; // Delete from disk $ model -> clearDisk ( ) ; // Delete model return parent :: delete ( $ model , $ config ) ; } } return false ; }
Delete the file and corresponding mappings.

@param \cmsgears\core\common\models\resources\File $model
@param array $config
@return boolean
Delete the file and corresponding mappings .