コード例 #1
0
ファイル: Posts.php プロジェクト: richlove1/avc-october
 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
ファイル: PostImport.php プロジェクト: richlove1/avc-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();
 }