public function youCannotSayThat() { // Register the new behavior BaseBehaviors::add(function ($tweet) { // I know we can improve this part but this is just an example $client = new Client(['base_uri' => 'http://www.wdyl.com/']); $request = $client->request('GET', 'profanity', ['query' => ['q' => $tweet->text]]); // We should return a boolean // true to exclude the tweet, false to include it $response = json_decode($request->getBody()->getContents()); return $response->response; }, __METHOD__); return $this; }
public function onlyRTsFromVerified() { BaseBehaviors::add(function ($tweet) { return $this->with('retweeted_status', $tweet) && $tweet->retweeted_status->user->verified; }, __METHOD__); return $this; }