public function actionDelete($id)
    {
        Yii::$app->response->format = Response::FORMAT_JSON;
        $routes = $this->module->routes;

        $model = Mediafile::findOne($id);

        if ($model->isImage()) {
            $model->deleteThumbs($routes);
        }

        $model->deleteFile($routes);
        $model->delete();

        return ['success' => 'true'];
    }
public function actionDelete($id)
    {
        Yii::$app->response->format = Response::FORMAT_JSON;
        $routes = $this->module->routes;

        $model = Mediafile::findOne($id);

        if ($model->isImage()) {
            $model->deleteThumbs($routes);
        }

        $model->deleteFile($routes);
        $model->delete();

        return ['success' => 'true'];
    }
public function actionDelete ( $ id ) { Yii :: $ app -> response -> format = Response :: FORMAT_JSON ; $ routes = $ this -> module -> routes ; $ model = Mediafile :: findOne ( $ id ) ; if ( $ model -> isImage ( ) ) { $ model -> deleteThumbs ( $ routes ) ; } $ model -> deleteFile ( $ routes ) ; $ model -> delete ( ) ; return [ 'success' => 'true' ] ; }
Delete model with files
@param $id
@return array
Delete model with files