コード例 #1
0
 public function testAkismetCustomApiInformation()
 {
     $akismet = new Akismet();
     $akismet->setApiBaseUrl('rest.internal.akismet.com');
     $akismet->setApiVersion('2.2');
     $akismet->setApiKey('123qwe456rty');
     $this->assertSame($akismet->getApiBaseUrl(), 'rest.internal.akismet.com');
     $this->assertSame($akismet->getApiVersion(), '2.2');
     $this->assertSame($akismet->getApiKey(), '123qwe456rty');
 }
コード例 #2
0
ファイル: BlogController.php プロジェクト: rhofma/rhofma.de
 public function comment(Requests\CommentRequest $request, $slug)
 {
     $post = Post::where('slug', $slug)->first();
     $akismet = new Akismet();
     $akismet->setApiKey(env('AKISMET_KEY', ''))->setBlogUrl('http://rhofma.de')->setCommentAuthor($request['name'])->setCommentAuthorEmail($request['email'])->setCommentContent($request['comment']);
     if (!empty($request['url'])) {
         $akismet->setCommentAuthorUrl($request['url']);
     }
     if ($akismet->isSpam()) {
         return back()->with('message', 'FU SPAMMER!');
     }
     Comment::create(['name' => $request['name'], 'email' => $request['email'], 'comment' => $request['comment'], 'url' => $request['url'], 'post_id' => $post->id]);
     return back()->with('message', 'Danke für das Kommentar :)');
 }