Beispiel #1
0
 public static function addCounter($id)
 {
     $model = Stream::findOne(['st_id' => $id]);
     $model->st_cnt += 1;
     $model->save(false);
 }
 /**
  * Finds the Stream model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Stream the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Stream::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }