Blame view

src/app/backend/controllers/BidController.php 1.25 KB
ef60cd4d   Administrator   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
  <?php
  namespace controllers;
  
  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  
  class BidController extends \Phalcon\Mvc\Controller
  {
  
      function indexAction()
      {
  
          $this->view->setVars([
          ]);
      }
  
      function addAction()
      {
          $model = new \rdsServices;
          $model->save();
  
          $model = \rdsServices::find(array("order" => 'id'));
          $model = $model->getLast();
          $this->view->disableLevel(\Phalcon\Mvc\View::LEVEL_MAIN_LAYOUT);
          $this->view->setVars([
              'item' => $model,
          ]);
  
      }
  
      function deleteAction()
      {
  
          $id = $this->request->get('id');
          $model = \rdsServices::findFirst("id = '$id'");
          if($model instanceof \rdsServices) {
              $model->delete();
          }
  
      }
  
      function updateAction()
      {
          $data  =  $this->request->getPost('data');
          $id  =  $this->request->getPost('id');
          $data = json_decode($data);
          $model = \rdsServices::findFirst(array("id = '$id'"));
          foreach(get_object_vars($data) as $key=>$value) {
              $array[$key] = $value;
          }
          $model->save($array);
          die();
      }
  
  
  }