Correcter
Correcter

Reputation: 3686

Yii2: how to set the default action into the controller

I know how to set the default controller/action into the configuration by the defaultRoute option

'defaultRoute'        => 'home/index'

But I don't how do it with the action into the current controller.

Can anybody help me?

Upvotes: 3

Views: 330

Answers (1)

Correcter
Correcter

Reputation: 3686

I have found the solution.

class MyController extends Controller {
     public $defaultAction = 'my-action';
}

Upvotes: 5

Related Questions