belongsTo('\App\Team'); } public function player() { return $this->belongsTo('\App\Player'); } public function mission() { return $this->belongsTo('\App\Mission'); } public static function claimed_timeout() { // find tweets claimed longer than a minute ago $timeout = 60; $tweets = Tweet::where('claimed_at', '<', date('Y-m-d H:i:s', time()-$timeout))->get(); foreach($tweets as $tweet) { $tweet->claimed_at = null; $tweet->save(); event(new NewTweetEvent($tweet)); } } public static function queued() { return Tweet::whereNull('claimed_at')->where('processed', 0)->where('mission_id', '>', 0)->orderBy('tweet_date', 'asc'); } }