| @@ 46-55 (lines=10) @@ | ||
| 43 | ||
| 44 | $infos = \Thujohn\Twitter\Facades\Twitter::getUsersLookup(['screen_name' => 'Symfomany','format' => 'php']); |
|
| 45 | ||
| 46 | if(!empty($infos)){ |
|
| 47 | DB::connection('mongodb')->collection('stats') |
|
| 48 | ->where(['origin' => 'Twitter', 'type' => 'infos'])->delete(); |
|
| 49 | ||
| 50 | $stat = new Stats(); |
|
| 51 | $stat->origin = "Twitter"; |
|
| 52 | $stat->type = "infos"; |
|
| 53 | $stat->data = $infos; |
|
| 54 | $stat->save(); |
|
| 55 | } |
|
| 56 | ||
| 57 | ||
| 58 | $tweets = \Thujohn\Twitter\Facades\Twitter::getDmsOut(['format' => 'php']); |
|
| @@ 59-71 (lines=13) @@ | ||
| 56 | ||
| 57 | ||
| 58 | $tweets = \Thujohn\Twitter\Facades\Twitter::getDmsOut(['format' => 'php']); |
|
| 59 | if(!empty($tweets)){ |
|
| 60 | ||
| 61 | DB::connection('mongodb')->collection('tweets') |
|
| 62 | ->where(['origin' => 'Twitter', 'type' => 'dmsout']) |
|
| 63 | ->delete(); |
|
| 64 | foreach($tweets as $tweet){ |
|
| 65 | $vi = new Tweets(); |
|
| 66 | $vi->origin = "Twitter"; |
|
| 67 | $vi->type = "dmsout"; |
|
| 68 | $vi->data = $tweet; |
|
| 69 | $vi->save(); |
|
| 70 | } |
|
| 71 | } |
|
| 72 | ||
| 73 | $tweets = \Thujohn\Twitter\Facades\Twitter::getFavorites(['format' => 'php']); |
|
| 74 | if(!empty($tweets)){ |
|
| @@ 74-86 (lines=13) @@ | ||
| 71 | } |
|
| 72 | ||
| 73 | $tweets = \Thujohn\Twitter\Facades\Twitter::getFavorites(['format' => 'php']); |
|
| 74 | if(!empty($tweets)){ |
|
| 75 | ||
| 76 | DB::connection('mongodb')->collection('tweets') |
|
| 77 | ->where(['origin' => 'Twitter', 'type' => 'favorites']) |
|
| 78 | ->delete(); |
|
| 79 | foreach($tweets as $tweet){ |
|
| 80 | $vi = new Tweets(); |
|
| 81 | $vi->origin = "Twitter"; |
|
| 82 | $vi->type = "favorites"; |
|
| 83 | $vi->data = $tweet; |
|
| 84 | $vi->save(); |
|
| 85 | } |
|
| 86 | } |
|
| 87 | ||
| 88 | $tweets = \Thujohn\Twitter\Facades\Twitter::getMentionsTimeline( |
|
| 89 | [ |
|
| @@ 93-105 (lines=13) @@ | ||
| 90 | 'count' => 15, |
|
| 91 | 'format' => 'php']); |
|
| 92 | ||
| 93 | if(!empty($tweets)){ |
|
| 94 | ||
| 95 | DB::connection('mongodb')->collection('tweets') |
|
| 96 | ->where(['origin' => 'Twitter', 'type' => 'mentionstimeline']) |
|
| 97 | ->delete(); |
|
| 98 | foreach($tweets as $tweet){ |
|
| 99 | $vi = new Tweets(); |
|
| 100 | $vi->origin = "Twitter"; |
|
| 101 | $vi->type = "mentionstimeline"; |
|
| 102 | $vi->data = $tweet; |
|
| 103 | $vi->save(); |
|
| 104 | } |
|
| 105 | } |
|
| 106 | ||
| 107 | $tweets = \Thujohn\Twitter\Facades\Twitter::getHomeTimeline( |
|
| 108 | [ |
|
| @@ 112-124 (lines=13) @@ | ||
| 109 | 'count' => 15, |
|
| 110 | 'format' => 'php']); |
|
| 111 | ||
| 112 | if(!empty($tweets)){ |
|
| 113 | ||
| 114 | DB::connection('mongodb')->collection('tweets') |
|
| 115 | ->where(['origin' => 'Twitter', 'type' => 'hometimeline']) |
|
| 116 | ->delete(); |
|
| 117 | foreach($tweets as $tweet){ |
|
| 118 | $vi = new Tweets(); |
|
| 119 | $vi->data = $tweet; |
|
| 120 | $vi->origin = "Twitter"; |
|
| 121 | $vi->type = "hometimeline"; |
|
| 122 | $vi->save(); |
|
| 123 | } |
|
| 124 | } |
|
| 125 | ||
| 126 | $tweets = \Thujohn\Twitter\Facades\Twitter::getUserTimeline( |
|
| 127 | [ |
|
| @@ 132-144 (lines=13) @@ | ||
| 129 | 'count' => 15, |
|
| 130 | 'format' => 'php']); |
|
| 131 | ||
| 132 | if(!empty($tweets)){ |
|
| 133 | ||
| 134 | DB::connection('mongodb')->collection('tweets') |
|
| 135 | ->where(['origin' => 'Twitter', 'type' => 'usertimeline']) |
|
| 136 | ->delete(); |
|
| 137 | foreach($tweets as $tweet){ |
|
| 138 | $vi = new Tweets(); |
|
| 139 | $vi->data = $tweet; |
|
| 140 | $vi->origin = "Twitter"; |
|
| 141 | $vi->type = "usertimeline"; |
|
| 142 | $vi->save(); |
|
| 143 | } |
|
| 144 | } |
|
| 145 | } |
|
| 146 | } |
|
| 147 | ||