ProjectController.php 1.24 KB
<?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 ];
        }

    }