本文整理汇总了PHP中yii\rest\ActiveController类的典型用法代码示例。如果您正苦于以下问题:PHP ActiveController类的具体用法?PHP ActiveController怎么用?PHP ActiveController使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ActiveController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actions
/**
* 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;
}
示例2: actions
public function actions()
{
$actions = parent::actions();
// personalizza il data provider preparation con il metodo "prepareDataProvider()"
$actions['index']['prepareDataProvider'] = [$this, 'prepareDataProvider'];
return $actions;
}
示例3: behaviors
public function behaviors()
{
$behaviors = parent::behaviors();
$behaviors['authenticator']['class'] = QueryParamAuth::className();
$behaviors['authenticator']['tokenParam'] = 'access_token';
return $behaviors;
}
示例4: behaviors
public function behaviors()
{
$behaviors = parent::behaviors();
$behaviors['authenticator'] = ['class' => HttpBearerAuth::className(), 'except' => ['options']];
$behaviors['corsFilter'] = ['class' => Cors::className()];
return $behaviors;
}
示例5: actions
public function actions()
{
$actions = parent::actions();
unset($actions['index']);
unset($actions['view']);
return $actions;
}
示例6: behaviors
public function behaviors()
{
$behaviors = parent::behaviors();
$behaviors['authenticator'] = ['class' => HttpBearerAuth::className()];
$behaviors['contentNegotiator'] = ['class' => ContentNegotiator::className(), 'formats' => ['application/json' => Response::FORMAT_JSON]];
return $behaviors;
}
示例7: behaviors
public function behaviors()
{
$behaviors = parent::behaviors();
$behaviors['authenticator'] = ['class' => CompositeAuth::className(), 'except' => ['login', 'error'], 'authMethods' => [HttpBearerAuth::className()]];
unset($behaviors['rateLimiter']);
return $behaviors;
}
示例8: behaviors
/**
* @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;
}
示例9: behaviors
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;
}
示例10: behaviors
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;
}
示例11: actions
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;
}
示例12: behaviors
public function behaviors()
{
$self = self::className();
$behaviors = parent::behaviors();
$behaviors['access'] = ['class' => \app\components\filters\AccessControl::className(), 'rules' => $self::getAccessRules()];
return $behaviors;
}
示例13: behaviors
public function behaviors()
{
$behaviors = parent::behaviors();
$behaviors['verbs'] = ['class' => VerbFilter::className(), 'actions' => ['indexWithQuote' => ['get']]];
$behaviors['authenticator'] = ['class' => HttpBasicAuth::className()];
return $behaviors;
}
示例14: behaviors
public function behaviors()
{
$behaviors = parent::behaviors();
// enabled HttpBearerAuth
$behaviors['authenticator'] = ['class' => HttpBearerAuth::className()];
return $behaviors;
}
示例15: behaviors
/**
* 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;
}