|
2 | 2 |
|
3 | 3 | namespace app\controllers; |
4 | 4 |
|
| 5 | +use app\models\ContactForm; |
| 6 | +use app\models\LoginForm; |
| 7 | +use app\services\DummyServiceInterface; |
5 | 8 | use Yii; |
6 | 9 | use yii\filters\AccessControl; |
7 | 10 | use yii\filters\VerbFilter; |
8 | | -use app\models\LoginForm; |
9 | | -use app\models\ContactForm; |
10 | 11 |
|
11 | 12 | class SiteController extends BaseController |
12 | 13 | { |
| 14 | + /** @var DummyServiceInterface */ |
| 15 | + protected $dummyService; |
| 16 | + |
| 17 | + public function __construct($id, $module, DummyServiceInterface $dummyService, $config = []) |
| 18 | + { |
| 19 | + $this->dummyService = $dummyService; |
| 20 | + parent::__construct($id, $module, $config); |
| 21 | + } |
| 22 | + |
13 | 23 | public function behaviors() |
14 | 24 | { |
15 | 25 | return [ |
@@ -51,6 +61,11 @@ public function actionIndex() |
51 | 61 | return $this->render('index'); |
52 | 62 | } |
53 | 63 |
|
| 64 | + public function actionServiceTest() |
| 65 | + { |
| 66 | + return $this->dummyService->shout("Hello World"); |
| 67 | + } |
| 68 | + |
54 | 69 | public function actionLogin() |
55 | 70 | { |
56 | 71 | if (!\Yii::$app->user->isGuest) { |
@@ -88,8 +103,9 @@ public function actionContact() |
88 | 103 |
|
89 | 104 | public function actionAbout() |
90 | 105 | { |
91 | | - if($this->getUser()->isGuest) |
| 106 | + if ($this->getUser()->isGuest) { |
92 | 107 | return $this->getUser()->loginRequired(); |
| 108 | + } |
93 | 109 | return $this->render('about'); |
94 | 110 | } |
95 | 111 | } |
0 commit comments