public function blogPublish(Request $request, Response $response)
    {
        if ($check = $this->sentinel->hasPerm('blog.update', 'dashboard', $this->config['blog-enabled'])) {
            return $check;
        }

        $post = BlogPosts::find($request->getParam('post_id'));

        if (!$post) {
            $this->flash('danger', 'That post does not exist.');
            return $this->redirect($response, 'admin-blog');
        }

        if (!$this->auth->check()->inRole('manager')
            && !$this->auth->check()->inRole('admin')
            && $post->user_id != $this->auth->check()->id) {
            $this->flash('danger', 'You do not have permission to edit that post.');
            return $this->redirect($response, 'admin-blog');
        }

        if ($this->blogUtils->publish()) {
            $this->flash('success', 'Post was published successfully.');
            return $this->redirect($response, 'admin-blog');
        }

        $this->flash('danger', 'There was an error publishing your post.');
        return $this->redirect($response, 'admin-blog');
    }
public function blogPublish(Request $request, Response $response)
    {
        if ($check = $this->sentinel->hasPerm('blog.update', 'dashboard', $this->config['blog-enabled'])) {
            return $check;
        }

        $post = BlogPosts::find($request->getParam('post_id'));

        if (!$post) {
            $this->flash('danger', 'That post does not exist.');
            return $this->redirect($response, 'admin-blog');
        }

        if (!$this->auth->check()->inRole('manager')
            && !$this->auth->check()->inRole('admin')
            && $post->user_id != $this->auth->check()->id) {
            $this->flash('danger', 'You do not have permission to edit that post.');
            return $this->redirect($response, 'admin-blog');
        }

        if ($this->blogUtils->publish()) {
            $this->flash('success', 'Post was published successfully.');
            return $this->redirect($response, 'admin-blog');
        }

        $this->flash('danger', 'There was an error publishing your post.');
        return $this->redirect($response, 'admin-blog');
    }
public function blogPublish ( Request $ request , Response $ response ) { if ( $ check = $ this -> sentinel -> hasPerm ( 'blog.update' , 'dashboard' , $ this -> config [ 'blog-enabled' ] ) ) { return $ check ; } $ post = BlogPosts :: find ( $ request -> getParam ( 'post_id' ) ) ; if ( ! $ post ) { $ this -> flash ( 'danger' , 'That post does not exist.' ) ; return $ this -> redirect ( $ response , 'admin-blog' ) ; } if ( ! $ this -> auth -> check ( ) -> inRole ( 'manager' ) && ! $ this -> auth -> check ( ) -> inRole ( 'admin' ) && $ post -> user_id != $ this -> auth -> check ( ) -> id ) { $ this -> flash ( 'danger' , 'You do not have permission to edit that post.' ) ; return $ this -> redirect ( $ response , 'admin-blog' ) ; } if ( $ this -> blogUtils -> publish ( ) ) { $ this -> flash ( 'success' , 'Post was published successfully.' ) ; return $ this -> redirect ( $ response , 'admin-blog' ) ; } $ this -> flash ( 'danger' , 'There was an error publishing your post.' ) ; return $ this -> redirect ( $ response , 'admin-blog' ) ; }
Publish Blog Post
Publish Blog Post