Blame view

backend/controllers/CartController.php 1.74 KB
f68e7edd   Mihail   add bills models,...
1
2
3
4
  <?php
  
  namespace backend\controllers;
  
f6c3dc95   Mihail   finish with cart ...
5
  use common\models\Cart;
f68e7edd   Mihail   add bills models,...
6
7
8
9
  use Yii;
  use common\models\CartBillsView;
  use common\models\CartBillsSearch;
  use backend\components\base\BaseController;
f6c3dc95   Mihail   finish with cart ...
10
  use yii\data\ActiveDataProvider;
f68e7edd   Mihail   add bills models,...
11
12
  use yii\web\NotFoundHttpException;
  use yii\filters\VerbFilter;
f68e7edd   Mihail   add bills models,...
13
14
15
16
17
18
19
  
  /**
   * CartController implements the CRUD actions for CartBills model.
   */
  class CartController extends BaseController
  {
      public $layout = "/column";
9755cb59   Mihail   fixed permissions...
20
  
f68e7edd   Mihail   add bills models,...
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
      /**
       * Lists all CartBills models.
       * @return mixed
       */
      public function actionIndex()
      {
          $searchModel = new CartBillsSearch();
          $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  
          return $this->render('index', [
              'searchModel' => $searchModel,
              'dataProvider' => $dataProvider,
          ]);
      }
  
      /**
       * Displays a single CartBills model.
       * @param string $id
       * @return mixed
       */
      public function actionView($id)
      {
f6c3dc95   Mihail   finish with cart ...
43
44
45
46
47
48
49
50
51
          $provider = new ActiveDataProvider([
              'query' => Cart::find()->where(['bill_id' => $id]),
              'sort' => false,
  
          ]);
  
          return $this->renderAjax('view', [
              'id' => $id,
              'provider' => $provider,
f68e7edd   Mihail   add bills models,...
52
53
54
55
56
57
58
59
60
61
62
63
64
          ]);
      }
  
  
      /**
       * Finds the CartBills model based on its primary key value.
       * If the model is not found, a 404 HTTP exception will be thrown.
       * @param string $id
       * @return CartBills the loaded model
       * @throws NotFoundHttpException if the model cannot be found
       */
      protected function findModel($id)
      {
f6c3dc95   Mihail   finish with cart ...
65
          if (($model = Cart::findOne(['bill_id' => $id])) !== null) {
f68e7edd   Mihail   add bills models,...
66
67
68
69
70
71
              return $model;
          } else {
              throw new NotFoundHttpException('The requested page does not exist.');
          }
      }
  }