您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

35 行
766B

  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\rest;
  8. use Yii;
  9. /**
  10. * ViewAction implements the API endpoint for returning the detailed information about a model.
  11. *
  12. * @author Qiang Xue <qiang.xue@gmail.com>
  13. * @since 2.0
  14. */
  15. class ViewAction extends Action
  16. {
  17. /**
  18. * Displays a model.
  19. * @param string $id the primary key of the model.
  20. * @return \yii\db\ActiveRecordInterface the model being displayed
  21. */
  22. public function run($id)
  23. {
  24. $model = $this->findModel($id);
  25. if ($this->checkAccess) {
  26. call_user_func($this->checkAccess, $this->id, $model);
  27. }
  28. return $model;
  29. }
  30. }