コード例 #1
0
ファイル: Posts.php プロジェクト: janusnic/OctoberCMS
 public function index_onDelete()
 {
     if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) {
         foreach ($checkedIds as $postId) {
             if (!($post = Post::find($postId)) || !$post->canEdit($this->user)) {
                 continue;
             }
             $post->delete();
         }
         Flash::success('Successfully deleted those posts.');
     }
     return $this->listRefresh();
 }
コード例 #2
0
ファイル: BlogPost.php プロジェクト: janusnic/OctoberCMS
 /**
  * Returns the URL for the master object of given ID
  *
  * @param  MenuItem  $item Master object iD
  *
  * @return string
  */
 public function getUrl(MenuItem $item)
 {
     $page_url = Settings::get('blog_post_page', 'blog/post');
     $post = Post::find($item->master_object_id);
     if (!$post) {
         throw new ApplicationException("Post not found.");
     }
     return URL::to($page_url . '/' . $post->slug);
 }
コード例 #3
0
ファイル: PostImport.php プロジェクト: mechiko/staff-october
 protected function findDuplicatePost($data)
 {
     if ($id = array_get($data, 'id')) {
         return Post::find($id);
     }
     $title = array_get($data, 'title');
     $post = Post::where('title', $title);
     if ($slug = array_get($data, 'slug')) {
         $post->orWhere('slug', $slug);
     }
     return $post->first();
 }