Alert Should Be Executed Or Shown On Certain Condition

This code is written in controller say in ‘If’ block

Yii::$app->getSession()->setFlash('success', 'New Group is successfully created.');

Then to show Alert which code should I write in View.

I have tried below code with above code:


       'options' => [

                'class' => 'alert-warning',



echo 'Say hello...';


But It shows Alert on every new request, without 1st code execution on various condition.

Please Help.