public function createAction($id) { $part = explode('_', $id); if (isset($part[0]) && isset($part[1]) && strpos($part[0], 'img') !== false) { $this->getPhoto(str_replace('img', '', $part[0]), $part[1]); exit; } return parent::createAction($id); }
/** * @inheritdoc */ public function init() { // check for admin permission (`tbl_role.can_admin`) // note: check for Yii::$app->user first because it doesn't exist in console commands (throws exception) if (!empty(Yii::$app->user) && !Yii::$app->user->can("admin")) { throw new ForbiddenHttpException('You are not allowed to perform this action.'); } parent::init(); }