Displays a single Post model.
@param integer $id
@param string $slug
@return mixed
423389
public function actionView($id = 0, $slug= '')
    {
        $model = $this->findModel($id, $slug);
        if (\Yii::$app->user->can('viewPost', ['post' => $model])) {
            return $this->render('view', [
                'model' => $model,
            ]);
        } else
            throw new ForbiddenHttpException(Module::t('core', 'Access denied.'));
    }
1347899
public static function checkSlug($slug, $id = 0)
    {
        $count = self::factory()
                    ->where('slug',$slug)
                    ->where_not_equal('id',$id)
                    ->count();

        return $count > 0;
    }
990021
public function actionView($id = null, $slug = null)
    {
        $model = User::find()->where(['and',
                ['id' => $id],
                ['!=', 'status', User::STATUS_REGISTERED],
                ['or',
                    ['slug' => $slug],
                    ['slug' => ''],
                    ['slug' => null],
                ]
            ])->limit(1)->one();
        if (empty($model)) {
            $this->error(Yii::t('podium/flash', 'Sorry! We can not find Member with this ID.'));
            return $this->redirect(['members/index']);
        }
        return $this->render('view', ['model' => $model]);
    }
936119
public function show($id)
    {
        $request = $this->makeRequest('show');
        $model = $this->service->get($id);
        return $this->maybeMakeResource('single', $model);

    }
721203
public function getPost($id)
	{
            $post = \App\Blog::find($id);
            if($post == NULL){
                App::abort(404);
            }
            return View('blog::post',array('title'=>$post['title'],'post'=>$post));
	}
589580
public function run($id = null, $slug = null)
    {
        if (!is_numeric($id) || $id < 1 || empty($slug)) {
            $this->controller->error(Yii::t('podium/flash', 'Sorry! We can not find the user you are looking for.'));
            return $this->controller->redirect(['members/index']);
        }

        $user = User::find()->where(['and',
            ['id' => $id],
            ['or',
                ['slug' => $slug],
                ['slug' => ''],
                ['slug' => null],
            ]
        ])->limit(1)->one();
        if (empty($user)) {
            $this->controller->error(Yii::t('podium/flash', 'Sorry! We can not find the user you are looking for.'));
            return $this->controller->redirect(['members/index']);
        }
        return $this->controller->render($this->view, ['user' => $user]);
    }
968283
public function viewAction($id)
    {
        $post = $this->get('opifer.form.post_manager')->getRepository()->find($id);

        if (!$post) {
            return $this->createNotFoundException();
        }

        return $this->render($this->getParameter('opifer_form.post_view_view'), [
            'post' => $post,
        ]);
    }
288493
public function show($slug)
	{
		try
		{
			return View::make($this->theme.'/pages/'.$slug);
		}
		catch (\InvalidArgumentException $e)
		{
			return App::abort(404, 'Page not found');
		}
	}
253329
public function changeStatus($slug, $id, $status)
    {
        $current_model = Base::getModel($slug);

        if($current_model = $current_model::findOne($id)){
            $current_model->status = $status;
            $current_model->save();
        }else{
            $this->error = Yii::t('easyii2', 'Not found');
        }

        return $this->formatResponse(Yii::t('easyii2', 'Status successfully changed'));
    }
1007970
public function findIdUrl($id, $url)
    {
        return $this->getModel()->where('id', $id)->where('slug_url', $url)->first();
    }
903328
public function actionClearFile($attribute, $slug, $id)
    {
        $current_model = $this->module->getModel($slug);

        $current_model = $current_model::findOne($id);

        if($current_model === null){
            $this->flash('error', Yii::t('easyii', 'Not found'));
        }else{
            $url = $current_model->$attribute;
            $current_model->$attribute = '';
            if($current_model->update()){
                @unlink(Yii::getAlias('@webroot').$url);
                $this->flash('success', Yii::t('easyii', 'File cleared'));
            } else {
                $this->flash('error', Yii::t('easyii', 'Update error. {0}', $current_model->formatErrors()));
            }
        }
        return $this->back();
    }
1271523
protected function validatePost($title, $slug, $id = null)
	{
		$rules = array(
			'title' => 'required',
			'slug'  => 'required|unique:posts,slug',
		);

		if ($id)
		{
			$rules['slug'] .= ','.$id;
		}

		with($validator = Validator::make(compact('title', 'slug'), $rules))->fails();

		return $validator->errors();
	}
515664
public function actionShow($id = null)
    {
        if (!is_numeric($id) || $id < 1) {
            $this->error(Yii::t('podium/flash', 'Sorry! We can not find the post you are looking for.'));
            return $this->redirect(['forum/index']);
        }

        $post = Post::find()->where(['id' => $id])->limit(1)->one();
        if (empty($post)) {
            $this->error(Yii::t('podium/flash', 'Sorry! We can not find the post you are looking for.'));
            return $this->redirect(['forum/index']);
        }

        $url = [
            'forum/thread',
            'cid' => $post->thread->category_id,
            'fid' => $post->forum_id,
            'id' => $post->thread_id,
            'slug' => $post->thread->slug
        ];

        try {
            $count = (new Query)->from(Post::tableName())->where([
                    'and',
                    ['thread_id' => $post->thread_id],
                    ['<', 'id', $post->id]
                ])->count();
            $page = floor($count / 10) + 1;
            if ($page > 1) {
                $url['page'] = $page;
            }
            $url['#'] = 'post' . $post->id;
            return $this->redirect($url);
        } catch (Exception $e) {
            $this->error(Yii::t('podium/flash', 'Sorry! We can not find the post you are looking for.'));
            return $this->redirect(['forum/index']);
        }
    }
911248
public function view($slug = null, $id = null)
    {
        //This allows backward compatibility for URLs like `/photo/11`
        if (empty($slug)) {
            $slug = $this->Photos->findById($id)
                ->contain([$this->Photos->Albums->getAlias() => ['fields' => ['slug']]])
                ->extract('album.slug')
                ->first();

            return $this->redirect(compact('id', 'slug'), 301);
        }

        $photo = $this->Photos->findActiveById($id)
            ->select(['id', 'album_id', 'filename', 'active', 'modified'])
            ->contain([$this->Photos->Albums->getAlias() => ['fields' => ['id', 'title', 'slug']]])
            ->cache(sprintf('view_%s', md5($id)), $this->Photos->getCacheName())
            ->firstOrFail();

        $this->set(compact('photo'));
    }
952750
public function getById($id)
    {
        $modelResult = $this->getRequest()->request(
            'GET',
            $this->getRequestUrl(sprintf('models/%s', $id))
        );

        return $this->getModelFromResult($modelResult);
    }
584610
public function getPostShow($id)
    {
        $title      = "Inlägg";
        $text       = new ShowOneService($this->di, $id);

        $data = [
            "items" => $text->getHTML(),
        ];

        $crud = "comm/crud/view-one";
        $this->toRender($title, $crud, $data);
    }
534066
public function actionView($id)
    {
        $model = $this->findModel($id);
        $model->updateCounters(['views' => 1]);
        return $this->render($model->view, [
            'model' => $model,
        ]);
    }