php yii-rest-ActiveController类(方法)实例源码

下面列出了php yii-rest-ActiveController 类(方法)源码代码实例,从而了解它的用法。

作者:luyade    项目:luya-cor   
/**
  * Override the base actions in order to support some enhancements of actions
  * by default for all active controllers.
  * @see \yii\rest\ActiveController::actions()
  */
 public function actions()
 {
     $actions = parent::actions();
     $actions['index']['class'] = '\\luya\\rest\\actions\\IndexAction';
     $actions['delete']['class'] = '\\luya\\rest\\actions\\DeleteAction';
     return $actions;
 }

作者:antonio7    项目:daduu4   
public function actions()
 {
     $actions = parent::actions();
     // personalizza il data provider preparation con il metodo "prepareDataProvider()"
     $actions['index']['prepareDataProvider'] = [$this, 'prepareDataProvider'];
     return $actions;
 }

作者:foske    项目:db   
public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['authenticator']['class'] = QueryParamAuth::className();
     $behaviors['authenticator']['tokenParam'] = 'access_token';
     return $behaviors;
 }

作者:kuznetsov020    项目:mercdev-soccer-serve   
public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['authenticator'] = ['class' => HttpBearerAuth::className(), 'except' => ['options']];
     $behaviors['corsFilter'] = ['class' => Cors::className()];
     return $behaviors;
 }

作者:Acker201    项目:CustomizeLif   
public function actions()
 {
     $actions = parent::actions();
     unset($actions['index']);
     unset($actions['view']);
     return $actions;
 }

作者:Andriy    项目:tea   
public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['authenticator'] = ['class' => HttpBearerAuth::className()];
     $behaviors['contentNegotiator'] = ['class' => ContentNegotiator::className(), 'formats' => ['application/json' => Response::FORMAT_JSON]];
     return $behaviors;
 }

作者:booki    项目:yii2-rest-exampl   
public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['authenticator'] = ['class' => CompositeAuth::className(), 'except' => ['login', 'error'], 'authMethods' => [HttpBearerAuth::className()]];
     unset($behaviors['rateLimiter']);
     return $behaviors;
 }

作者:pylype    项目:api-sid   
/**
  * @inheritdoc
  */
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['rateLimiter'] = ['class' => RateLimiter::className(), 'enableRateLimitHeaders' => false];
     $behaviors['contentNegotiator'] = ['class' => ContentNegotiator::className(), 'formats' => ['application/json' => Response::FORMAT_JSON]];
     return $behaviors;
 }

作者:dimichsp    项目:yii2-api-aut   
public function behaviors()
 {
     $behaviors = parent::behaviors();
     //$behaviors['contentNegotiator']['formats']['text/html'] = Response::FORMAT_JSON; //setting JSON as default reply
     $behaviors['authenticator'] = ['class' => CompositeAuth::className(), 'authMethods' => [HttpBasicAuth::className(), HttpBearerAuth::className(), QueryParamAuth::className()]];
     return $behaviors;
 }

作者:EuresTool    项目:eVote-we   
public function behaviors()
 {
     $behaviors = parent::behaviors();
     /*
     // test with basic auth which can be set in params
     $behaviors['authenticator'] = [
     'class' => HttpBasicAuth::className(),
     'auth'  => function ($username, $password) {
         if ($username==\Yii::$app->params['HttpBasicAuth']['username'] && $password==\Yii::$app->params['HttpBasicAuth']['password']) {
             return new User();
         } else {
             return null;
         }
     }];
     */
     $behaviors['authenticator'] = ['class' => CompositeAuth::className(), 'authMethods' => [HttpBasicAuth::className(), QueryParamAuth::className()]];
     /*
     //set response header to application/json only
     $behaviors['contentNegotiator'] = [
             'class' => ContentNegotiator::className(),
             'formats' => [
                 'application/json' => Response::FORMAT_JSON,
     //            'application/xml' => Response::FORMAT_XML,
             ],
     ];
     */
     return $behaviors;
 }

作者:C12    项目:advancedap   
public function actions()
 {
     $actions = parent::actions();
     unset($actions['index'], $actions['update'], $actions['create'], $actions['delete'], $actions['view']);
     //unset($actions['update'], $actions['create'], $actions['delete'], $actions['view']);
     return $actions;
 }

作者:KleinMaximu    项目:picka   
public function behaviors()
 {
     $self = self::className();
     $behaviors = parent::behaviors();
     $behaviors['access'] = ['class' => \app\components\filters\AccessControl::className(), 'rules' => $self::getAccessRules()];
     return $behaviors;
 }

作者:soann    项目:stocks_mv   
public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['verbs'] = ['class' => VerbFilter::className(), 'actions' => ['indexWithQuote' => ['get']]];
     $behaviors['authenticator'] = ['class' => HttpBasicAuth::className()];
     return $behaviors;
 }

作者:gnatyu    项目:res   
public function behaviors()
 {
     $behaviors = parent::behaviors();
     // enabled HttpBearerAuth
     $behaviors['authenticator'] = ['class' => HttpBearerAuth::className()];
     return $behaviors;
 }

作者:bolom00    项目:testwork_ap   
/**
  * Some rules in this controller
  * @return Rules behaviors
  */
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     $behaviors['authenticator'] = ['class' => QueryParamAuth::className(), 'tokenParam' => 'token'];
     unset($behaviors['rateLimiter']);
     return $behaviors;
 }

作者:nveee    项目:Sandbo   
public function actions()
 {
     $actions = parent::actions();
     // remove parent's control over create
     unset($actions['create']);
     return $actions;
 }

作者:apmau    项目:1f8bf10ab74d6f5ca69f7c07b7ee1c3   
public function actions()
 {
     $actions = parent::actions();
     unset($actions['view']);
     $actions1 = ArrayHelper::merge(['actionPedido'], $actions);
     return $actions1;
 }

作者:xidia    项目:gxfenx   
/**
  * 行为扩展
  * @return array
  */
 public function behaviors()
 {
     $behaviors = parent::behaviors();
     //        $behaviors['contentNegotiator']['formats']['text/html'] = Response::FORMAT_HTML;
     $behaviors['contentNegotiator']['formats'] = ['application/json' => Response::FORMAT_JSON];
     return $behaviors;
 }

作者:exelent    项目:test-fornekk   
public function actions()
 {
     $actions = parent::actions();
     // disable the "delete" and "create" actions
     unset($actions['delete'], $actions['create']);
     return $actions;
 }

作者:xerxes33    项目:Dictionar   
public function behaviors()
 {
     $behaviors = parent::behaviors();
     // $behaviors['authenticator'] = [
         // 'class' => HttpBasicAuth::className(),
     // ];
     return $behaviors;
 }


问题


面经


文章

微信
公众号

扫码关注公众号