| 12345678910111213141516171819202122232425262728293031323334353637 | 
							- <?php
 
- namespace App\Listeners;
 
- use App\Events\CommentAdded;
 
- use Illuminate\Contracts\Queue\ShouldQueue;
 
- use Illuminate\Queue\InteractsWithQueue;
 
- use App\Models\Comment;
 
- use Illuminate\Support\Str;
 
- class PremoderateComment implements ShouldQueue
 
- {
 
-     /**
 
-      * Create the event listener.
 
-      */
 
-     public function __construct()
 
-     {
 
-         //
 
-     }
 
-     /**
 
-      * Handle the event.
 
-      */
 
- 	public function handle(CommentAdded $event): void
 
-     {
 
-         $comment = $event->comment;
 
-         $result = Str::of($comment->content)->match('/(http:|https:)/');
 
-         if ($result == "") {
 
- 			$comment->allow();
 
-         } else {
 
- 			$comment->makePending();
 
-         }
 
-     }
 
- }
 
 
  |