|
|
@ -27,10 +27,22 @@ class Tweet extends Model |
|
|
|
return $this->belongsTo('\App\Mission'); |
|
|
|
} |
|
|
|
|
|
|
|
public function transit_line() { |
|
|
|
return $this->belongsTo('\App\TransitLine', 'm1_transit_line_id'); |
|
|
|
} |
|
|
|
|
|
|
|
public function transit_center() { |
|
|
|
return $this->belongsTo('\App\TransitCenter', 'm2_transit_center_id'); |
|
|
|
} |
|
|
|
|
|
|
|
public function document() { |
|
|
|
return $this->belongsTo('\App\Document', 'm7_document_id'); |
|
|
|
} |
|
|
|
|
|
|
|
public static function claimed_timeout() { |
|
|
|
// time out tweets if they aren't processed after the specified time
|
|
|
|
$timeout = 520; |
|
|
|
$tweets = Tweet::where('claimed_at', '<', date('Y-m-d H:i:s', time()-$timeout))->get(); |
|
|
|
$tweets = Tweet::where('claimed_at', '<', date('Y-m-d H:i:s', time()-$timeout))->where('processed', 0)->get(); |
|
|
|
foreach($tweets as $tweet) { |
|
|
|
$tweet->claimed_at = null; |
|
|
|
$tweet->save(); |
|
|
|