diff --git a/frontend/controllers/BookController.php b/frontend/controllers/BookController.php index 3e56201..da49f24 100644 --- a/frontend/controllers/BookController.php +++ b/frontend/controllers/BookController.php @@ -9,6 +9,7 @@ namespace frontend\controllers; use common\models\Book; + use common\models\Support; use yii\data\ActiveDataProvider; use yii\web\Controller; use yii\web\UploadedFile; @@ -83,7 +84,12 @@ $dataProvider = new ActiveDataProvider( [ 'query' => Book::find() - ->with(['author', 'alias']) + ->with( + [ + 'author', + 'alias', + ] + ) ->where([ 'status' => Book::STATUS_ACTIVE ]), 'pagination' => [ 'pageSize' => 10, @@ -98,8 +104,26 @@ ); } - public function actionView($id){ - $model = Book::find()->with(['author', 'activeComments']) ->where(['id' => $id])->one(); - return $this->render('view', ['model' => $model]); + public function actionView($id) + { + $model = Book::find() + ->with( + [ + 'author', + 'activeComments', + ] + ) + ->where([ 'id' => $id ]) + ->one(); + $support = Support::find() + ->where([ 'book_id' => $model->id ]) + ->all(); + return $this->render( + 'view', + [ + 'model' => $model, + 'support' => $support, + ] + ); } } \ No newline at end of file diff --git a/frontend/views/book/view.php b/frontend/views/book/view.php index 15a6c78..cdda936 100644 --- a/frontend/views/book/view.php +++ b/frontend/views/book/view.php @@ -53,18 +53,26 @@
title?>
-
+
author->name?> author->secondname?>
price == null){ ?>
+
-

37620 грн. зібрано

-

460 підтримувачів

+ sum; + } + ?> +

грн. зібрано

+

підтримувачів

+
Підтримати -- libgit2 0.21.4