protected function findModelBySlug($slug) { if (($model = Slider::findOne(['name' => $slug])) !== null) { return $model; } else { throw new NotFoundHttpException(); } }
public function init() { parent::init(); if (!$this->id) { $sliderId = \app\modules\slider\models\backend\Slider::findOne(['name' => $this->name]); $this->id = $sliderId->id; } Html::addCssClass($this->options, ['widget' => 'hidden widget-slider-' . $this->id]); }
protected function findSlider($id) { if (($model = Slider::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }