2021-06-09 18:06:13 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace frontend\modules\api\controllers;
|
|
|
|
|
2021-06-14 17:26:05 +03:00
|
|
|
use common\behaviors\GsCors;
|
2021-06-09 18:06:13 +03:00
|
|
|
use common\models\Options;
|
|
|
|
use yii\filters\AccessControl;
|
2021-08-05 14:08:00 +03:00
|
|
|
use yii\filters\auth\QueryParamAuth;
|
2021-06-09 18:06:13 +03:00
|
|
|
|
|
|
|
class SkillsController extends \yii\rest\Controller
|
|
|
|
{
|
|
|
|
public function behaviors()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
[
|
|
|
|
'class' => \yii\filters\ContentNegotiator::className(),
|
|
|
|
'formats' => [
|
|
|
|
'application/json' => \yii\web\Response::FORMAT_JSON,
|
|
|
|
],
|
|
|
|
],
|
2021-08-05 14:08:00 +03:00
|
|
|
'authenticatior' => [
|
|
|
|
'class' => QueryParamAuth::class, //implement access token authentication
|
|
|
|
'except' => ['login'], // no need to verify the access token method, pay attention to distinguish between $noAclLogin
|
|
|
|
],
|
2021-08-05 18:41:09 +03:00
|
|
|
// 'corsFilter' => [
|
|
|
|
// 'class' => GsCors::class,
|
|
|
|
// 'cors' => [
|
|
|
|
// 'Origin' => ['*'],
|
|
|
|
// //'Access-Control-Allow-Credentials' => true,
|
|
|
|
// 'Access-Control-Allow-Headers' => [
|
|
|
|
// 'Content-Type',
|
|
|
|
// 'Access-Control-Allow-Headers',
|
|
|
|
// 'Authorization',
|
|
|
|
// 'X-Requested-With'
|
|
|
|
// ],
|
|
|
|
// ]
|
|
|
|
// ]
|
2021-06-09 18:06:13 +03:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function actionIndex()
|
|
|
|
{
|
|
|
|
return ['some' => 'rrr'];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function actionSkillsOnMainPage()
|
|
|
|
{
|
|
|
|
$data = \common\models\Options::getValue('skills_on_main_page_to_front');
|
|
|
|
if ($data) $data = json_decode($data, true);
|
|
|
|
else return [];
|
|
|
|
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|