You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

57 lines
1.3 KiB

<?php
namespace api\controllers;
use api\logic\Helper;
use backend\modules\shop\models\ars\Address;
use Yii;
use Throwable;
use yii\web\NotFoundHttpException;
/**
* @author iron
* @email weiriron@gmail.com
*/
class AddressController extends CommonController
{
public $modelClass = 'backend\modules\shop\models\ars\Address';
public $className = 'api\logic\AddressLogic';
/**
* @return object
* @throws yii\base\InvalidConfigException
*/
public function actionIndex()
{
$query = Address::find()->where(['user_id' => Yii::$app->user->getId()]);
return Helper::index($query);
}
/**
* @return bool
* @throws NotFoundHttpException
* @throws Yii\base\InvalidConfigException
* @throws Yii\db\StaleObjectException
* @throws Throwable
* @throws yii\base\Exception
* @throws yii\web\BadRequestHttpException
* @throws yii\web\ServerErrorHttpException
*/
public function actionUpdate()
{
return $this->object->update();
}
/**
* @return Address|null
* @throws NotFoundHttpException
* @throws yii\base\Exception
* @throws yii\web\BadRequestHttpException
* @throws yii\web\ServerErrorHttpException
*/
public function actionCreate()
{
return $this->object->create();
}
}