public function getFromMultipleSections($input = array(), $section_ids) { $posts = $this->post->published(); $posts = $posts->whereHas('section', function ($q) use($section_ids) { return $q->whereIn('id', $section_ids); }); $posts = $posts->orderBy('publish_date', 'desc'); $limit = (isset($input['limit']) and !empty($input['limit'])) ? $input['limit'] : Config::get('api.limit'); $limit = $this->checkLimit($limit); return $posts->paginate($limit); }
public function addVideos($post_id, $videos) { return $this->post->findOrFail($post_id)->videos()->saveMany($videos); }