public function actionView($id) { $statModel = Stat::findOne(['b_id' => $id]); if (!$statModel) { $statModel = new Stat(); } $statModel->b_id = $id; $statModel->views += 1; $statModel->save(); die('view recorded for: ' . $id); }