1 | <?php |
||
2 | |||
3 | namespace Apps\Controller\Admin\Main; |
||
4 | |||
5 | |||
6 | use Apps\Model\Admin\Main\FormYandexConnect; |
||
7 | use Ffcms\Core\App; |
||
8 | use Ffcms\Core\Arch\View; |
||
9 | use Ffcms\Core\Network\Request; |
||
10 | use Ffcms\Core\Network\Response; |
||
11 | |||
12 | /** |
||
13 | * Trait ActionYandexConnect |
||
14 | * @package Apps\Controller\Admin\Main |
||
15 | * @property Request $request |
||
16 | * @property Response $response |
||
17 | * @property View $view |
||
18 | */ |
||
19 | trait ActionYandexConnect |
||
20 | { |
||
21 | |||
22 | /** |
||
23 | * Connect yandex metrika and get token |
||
24 | * @return string|null |
||
25 | * @throws \Ffcms\Core\Exception\SyntaxException |
||
26 | */ |
||
27 | public function yandexConnect(): ?string |
||
28 | { |
||
29 | $configs = App::$Properties->getAll('yandex'); |
||
30 | |||
31 | $model = new FormYandexConnect($configs); |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
32 | if ($model->send() && $model->validate()) { |
||
33 | App::$Session->getFlashBag()->add('success', __('Application ID saved')); |
||
34 | $model->make(); |
||
35 | } |
||
36 | |||
37 | return $this->view->render('main/yandex_connect', [ |
||
38 | 'model' => $model |
||
39 | ]); |
||
40 | } |
||
41 | } |