当前位置: 首页>>代码示例>>PHP>>正文


PHP Post::delete方法代码示例

本文整理汇总了PHP中Post::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Post::delete方法的具体用法?PHP Post::delete怎么用?PHP Post::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Post的用法示例。


在下文中一共展示了Post::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     // Delete the notice from database
     $this->notice->delete();
     // Fire Event and Listeners
     event(new DeletedNotice($this->notice));
 }
开发者ID:sonusbeat,项目名称:soundcore,代码行数:12,代码来源:DeleteNotice.php

示例2: delete

 function delete($id = null)
 {
     if (!$id) {
         $this->flash(__('Invalid Post', true), array('action' => 'index'));
     }
     if ($this->Post->delete($id)) {
         $this->flash(__('Post deleted', true), array('action' => 'index'));
     } else {
         $this->flash(__('Post deleted Fail', true), array('action' => 'index'));
     }
 }
开发者ID:rafaelqueiroz,项目名称:mongoDB-Datasource,代码行数:11,代码来源:posts_controller.php

示例3: testCacheInvalidation

 /**
  * Verifies that main cache key resets every time post is edited.
  *
  * @return void
  * @since 0.1.0
  */
 public function testCacheInvalidation()
 {
     $value = \Yii::app()->cacheHelper->getPostsCacheTokenValue();
     $post = new \Post();
     $attrs = array('name' => 'just a name', 'slug' => 'just-a-name', 'content' => 'Dummy content', 'created' => '2010-05-05 12:12:12', 'user_id' => 1, 'category_id' => 1);
     $post->setAttributes($attrs, false);
     $post->save();
     $this->assertNotSame($value, $value = \Yii::app()->cacheHelper->getPostsCacheTokenValue());
     $post->delete();
     $this->assertNotSame($value, $value = \Yii::app()->cacheHelper->getPostsCacheTokenValue());
 }
开发者ID:EhteshamMehmood,项目名称:BlogMVC,代码行数:17,代码来源:PostTest.php

示例4: delete

 public function delete($id)
 {
     if (!self::owner($id)) {
         throw new NotAuthorized();
     }
     if ((string) (int) $id != $id) {
         throw new InvalidInput('Post id provided was not an integer: "' . $id . '" given');
     }
     Post::delete($id);
     echo 'Post deleted successfully.';
 }
开发者ID:natureday1,项目名称:Life,代码行数:11,代码来源:post.php

示例5: controlerJob

 public function controlerJob($maincont)
 {
     if ($maincont->isLoggued()) {
         if (isset($_GET["id"])) {
             $p = new Post($_GET["id"]);
             $p->delete();
         }
         $maincont->goModule("post", "admin");
     } else {
         $maincont->goModule("home", "display");
     }
 }
开发者ID:rogerwilko,项目名称:Yet-Another-Blog,代码行数:12,代码来源:controler.php

示例6: delete

 public function delete($where = null)
 {
     if ($where === null) {
         $where = array();
         foreach ($this->getPrimaryColumns() as $col) {
             $where[$col] = $this->{$col};
         }
         $this->clear();
     }
     $rows = $this->get($where);
     if ($rows) {
         foreach ($rows as $row) {
             $this->unlink('image', (array) $row);
         }
     }
     return parent::delete($where);
 }
开发者ID:Cevantime,项目名称:site-core-modules,代码行数:17,代码来源:Blogpost.php

示例7: saveAfter

 /**
  * @inheritdoc
  */
 public function saveAfter(Post $previous)
 {
     // If the previous post is another 'discussion renamed' post, and it's
     // by the same user, then we can merge this post into it. If we find
     // that we've in fact reverted the title, delete it. Otherwise, update
     // its content.
     if ($previous instanceof static && $this->user_id === $previous->user_id) {
         if ($previous->content[0] == $this->content[1]) {
             $previous->delete();
         } else {
             $previous->content = static::buildContent($previous->content[0], $this->content[1]);
             $previous->save();
         }
         return $previous;
     }
     $this->save();
     return $this;
 }
开发者ID:redstarxz,项目名称:flarumone,代码行数:21,代码来源:DiscussionRenamedPost.php

示例8: __construct

        break;
    case 'destroy':
        //各条件
        $cont->destroy(10);
        break;
    case 'view':
        //各条件
        $modl->view(10);
        break;
    case 'update':
        //各条件
        $modl->update(10);
        break;
    case 'delete':
        //各条件
        $modl->delete(10);
        break;
    default:
        echo 'It is error';
        break;
}
//controller class
class PostController
{
    //property
    private $resouce = '';
    private $action = '';
    private $view_options = '';
    //construct
    public function __construct()
    {
开发者ID:ta9yeah,项目名称:Fw_twitter_bbs,代码行数:31,代码来源:posts_controller.php

示例9: function

get('/user/:username', function ($app) {
    get_user_profile($app);
    $app->render('user/profile');
});
get('/user/:username/:skip', function ($app) {
    get_user_profile($app);
    $app->render('user/_posts', false);
});
post('/post', function ($app) {
    if (User::is_authenticated()) {
        $post = new Post();
        $post->content = $app->form('content');
        $post->create();
        $app->redirect('/user/' . User::current_user());
    } else {
        $app->set('error', 'You must be logged in to do that.');
        $app->render('user/login');
    }
});
delete('/post/delete/:id/:rev', function ($app) {
    $post = new Post();
    $post->_id = $app->request('id');
    $post->_rev = $app->request('rev');
    $post->delete();
    $app->redirect('/user/' . User::current_user());
});
get('/say/:message', function ($app) {
    $app->set('message', $app->request('message'));
    $app->render('home');
});
resolve();
开发者ID:juliosolis,项目名称:verge,代码行数:31,代码来源:index.php

示例10: array

     $default_file = FEATHERS_DIR . "/" . $post->feather . "/fields.php";
     $options = array();
     Trigger::current()->filter($options, array("edit_post_options", "post_options"), $post);
     $main->display("forms/post/edit", array("post" => $post, "feather" => Feathers::$instances[$post->feather], "options" => $options, "groups" => Group::find(array("order" => "id ASC"))));
     break;
 case "delete_post":
     $post = new Post($_POST['id'], array("drafts" => true));
     if ($post->no_results) {
         header("HTTP/1.1 404 Not Found");
         $trigger->call("not_found");
         exit;
     }
     if (!$post->deletable()) {
         show_403(__("Access Denied"), __("You do not have sufficient privileges to delete this post."));
     }
     Post::delete($_POST['id']);
     break;
 case "view_post":
     fallback($_POST['offset'], 0);
     fallback($_POST['context']);
     $reason = isset($_POST['reason']) ? $_POST['reason'] : "";
     if (isset($_POST['id'])) {
         $post = new Post($_POST['id'], array("drafts" => true));
     }
     if ($post->no_results) {
         header("HTTP/1.1 404 Not Found");
         $trigger->call("not_found");
         exit;
     }
     $main->display("feathers/" . $post->feather, array("post" => $post, "ajax_reason" => $reason));
     break;
开发者ID:vito,项目名称:chyrp-site,代码行数:31,代码来源:ajax.php

示例11: changesingular

        $posts->show(1);
        break;
    case 'edit':
        $posts->edit(1);
        break;
    case 'destroy':
        $posts->destroy(1);
        break;
    case 'view':
        $post->view(1);
        break;
    case 'update':
        $post->update(1);
        break;
    case 'delete':
        $post->delete(1);
    default:
        # code...
        break;
}
function changesingular($value)
{
    //複数形から単数形へ変換
    if ($value == 'posts') {
        return 'post';
    }
}
/**
 * Controllerのクラス
 */
class PostsController
开发者ID:ei17ringo,项目名称:fw_twitter_bbs,代码行数:31,代码来源:posts_controller.php

示例12: while

    {
        $query = "SELECT * FROM posts WHERE active=1 AND id > " . $lastId;
        $result = $this->db->query($query);
        while ($row = $result->fetch_object()) {
            $out[] = $row;
        }
        if (empty($out)) {
            $out[] = '';
        }
        return $out;
    }
}
if (isset($_POST['findNew'])) {
    $post = new Post();
    $out = $post->findNew($_POST['findNew']);
    if (!empty($out)) {
        echo json_encode($out);
    } else {
        header('HTTP/1.1 500 Fuck');
        exit;
    }
}
if (isset($_POST['deleteId'])) {
    $post = new Post();
    $post->delete($_POST['deleteId']);
}
if (isset($_POST['body'])) {
    $post = new Post();
    $post->setBody($_POST['body']);
    $post->add();
}
开发者ID:kavalanche,项目名称:ajaxTest,代码行数:31,代码来源:post.php

示例13: delPost

 private function delPost()
 {
     $post = new Post($_GET["id"]);
     $post->delete();
     header("Location: home.php");
 }
开发者ID:vitozy,项目名称:vyblog,代码行数:6,代码来源:ContentmanagerController.php

示例14: deletePost

 /**
  * Delete post
  */
 function deletePost()
 {
     $pid = intval($this->params['pid']);
     if ($pid > 0) {
         Doo::loadModel('Post');
         $p = new Post();
         $p->id = $pid;
         $p->delete();
         //clear the sidebar cache
         Doo::cache('front')->flushAllParts();
         $data['rootUrl'] = Doo::conf()->APP_URL;
         $data['title'] = 'Post Deleted!';
         $data['content'] = "<p>Post with ID {$pid} is deleted successfully!</p>";
         $this->render('admin_msg', $data);
     }
 }
开发者ID:mindaugas-valinskis,项目名称:doophp,代码行数:19,代码来源:AdminController.php

示例15: function

            }
        }
        $j = ["post_id" => $p->getID(), "liked" => false, "tapped_into" => false, "likes_count" => 0, "comments_count" => 0, "taps_count" => 0, "text" => $p->getText(), "time" => $p->getTime(), "category" => $p->getCategory()->getName(), "user" => $user, "images" => $ijson, "comments" => []];
        echo json_encode($j);
    } else {
        echo json_encode(["status" => false]);
    }
});
$app->get('/posts', function () use($app) {
    $posts = App::getPosts(["limit" => 25, "user_id" => 13]);
    echo json_encode(Utility::formatActivitiesToPosts($posts, $app));
});
$app->delete('/posts/:id', function ($id) use($app) {
    $p = new Post($id);
    if ($p->getID() && $app->environment()['testify.user_id'] == $p->getAuthor()->getID()) {
        $p->delete();
        if ($p) {
            echo json_encode(['status' => true]);
        }
    }
});
$app->post('/posts/:id/favorites', function ($id) use($app) {
    if ($uid = $app->environment['testify.user_id']) {
        $post = new Post($id);
        if ($post) {
            $u = new User($uid);
            $u->favoritePost($post, true);
            echo json_encode(array("favorites" => $post->countFavorites(), "status" => true));
        }
    }
});
开发者ID:sheyooo,项目名称:testify,代码行数:31,代码来源:index.php


注:本文中的Post::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。