Blame view

frontend/controllers/ProjectController.php 1.29 KB
14a09168   Alex Savenko   init 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
  <?php

      namespace frontend\controllers;

  

      use common\models\Portfolio;

      use common\models\Project;

      use common\models\Specialization;

      use common\models\User;

      use yii\web\Controller;

      use yii\web\NotFoundHttpException;

  

      /**

       * Project AJAX controller

       */

      class ProjectController extends Controller

      {

  

          public $enableCsrfValidation = false;

  

          public function behaviors()

          {

              return [

  

              ];

          }

  

          public function actionProjectAll()

          {

              $request = \Yii::$app->request;

              $response = \Yii::$app->response;

              $response->format = $response::FORMAT_JSON;

              $projects = Project::find()

                                     ->asArray()

                                     ->andWhere([

                                         'not',

                                         [ 'project.lat' => NULL ],

                                     ])

                                     ->andWhere([

                                         'not',

                                         [ 'project.lng' => NULL ],

                                     ])

                                     ->all();

              return [ 'result' => $projects ];

          }

  

      }