/** * Finds the FileStorageItem model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return FileStorageItem the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = FileStorageItem::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider * @throws \yii\base\InvalidParamException */ public function search($params) { $query = FileStorageItem::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'size' => $this->size, 'created_at' => $this->created_at]); $query->andFilterWhere(['like', 'component', $this->component])->andFilterWhere(['like', 'base_url', $this->base_url])->andFilterWhere(['like', 'path', $this->path])->andFilterWhere(['like', 'type', $this->type])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'upload_ip', $this->upload_ip]); return $dataProvider; }
?> " class="small-box-footer"> <?php echo Yii::t('backend', 'More info'); ?> <i class="fa fa-arrow-circle-right"></i> </a> </div> </div><!-- ./col --> <div class="col-lg-3 col-xs-6"> <!-- small box --> <div class="small-box bg-red"> <div class="inner"> <h3> <?php echo FileStorageItem::find()->count(); ?> </h3> <p> <?php echo Yii::t('backend', 'Files in storage'); ?> </p> </div> <div class="icon"> <i class="ion ion-pie-graph"></i> </div> <a href="<?php echo Yii::$app->urlManager->createUrl(['/file-storage/index']); ?> " class="small-box-footer">
/** * @param $event \trntv\filekit\events\StorageEvent */ public function afterDelete($event) { FileStorageItem::deleteAll(['component' => $this->component, 'path' => $event->path]); }