tweet; // Tweet out when missions are completed $newMissionStatus = $tweet->mission->complete($tweet->team); if($event->previousMissionStatus == false && $newMissionStatus == true) { $text = 'Team '.$tweet->team->name.' completed mission '.$tweet->mission_id.'! '.$tweet->mission->hashtag; Log::info("Tweeting: $text"); $params = [ 'attachment_url' => 'https://twitter.com/'.$tweet->player->twitter.'/status/'.$tweet->tweet_id, 'status' => $text ]; Twitter::postTweet($params); } // Tweet about bonus points when a team visits a TC nobody else has been to if($tweet->mission_id == 2 && $tweet->transit_center) { $this_tc = $tweet->m2_transit_center_id; $other_teams = Tweet::where('team_id', '!=', $tweet->team_id) ->where('m2_complete', 1) ->where('m2_transit_center_id', $this_tc) ->count(); if($other_teams == 0) { $text = 'Team '.$tweet->team->name.' is currently the only team to have visited '.$tweet->transit_center->name.'!'; Log::info("Tweeting: $text"); $params = [ 'attachment_url' => 'https://twitter.com/'.$tweet->player->twitter.'/status/'.$tweet->tweet_id, 'status' => $text ]; Twitter::postTweet($params); } } } }