- Rebases master

This commit is contained in:
Vlad
2016-06-17 15:00:46 -04:00
parent 999a0b3ede
commit c83ab0886f
5 changed files with 144 additions and 94 deletions

View File

@ -13,17 +13,16 @@ class Posts {
preg_match_all(
'/data-post-id="(\d+)"/ism',
$newsletter['rendered_body']['html'],
$matached_posts);
$matached_posts = $matached_posts[1];
if(!count($matached_posts)) {
$matched_posts_ids);
$matched_posts_ids = $matched_posts_ids[1];
if(!count($matched_posts_ids)) {
return $newsletter;
}
foreach($matached_posts as $post) {
foreach($matched_posts_ids as $post_id) {
$newletter_post = NewsletterPost::create();
$newletter_post->newsletter_id = $newsletter['id'];
$newletter_post->post_id = $post;
$newletter_post->post_id = $post_id;
$newletter_post->save();
}
return $newsletter;
}
}