Passed
Push — main ( 4834b9...990a94 )
by Usama
03:51
created
database/factories/CommentFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
     {
22 22
         return [
23 23
             'body' => fake()->text,
24
-            'user_id' => function () {
24
+            'user_id' => function() {
25 25
                 return User::factory()->create()->id;
26 26
             },
27 27
             'parent_id' => null,
Please login to merge, or discard this patch.
database/migrations/2023_02_24_000000_create_comments_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
      */
11 11
     public function up(): void
12 12
     {
13
-        Schema::create('comments', function (Blueprint $table) {
13
+        Schema::create('comments', function(Blueprint $table) {
14 14
             $table->id();
15 15
             $table->foreignId('user_id')->constrained()->onDelete('cascade');
16 16
             $table->foreignId('parent_id')->nullable()->constrained('comments')->onDelete('cascade');
Please login to merge, or discard this patch.
database/migrations/2023_03_24_000000_create_comment_likes_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
      */
11 11
     public function up(): void
12 12
     {
13
-        Schema::create('comment_likes', function (Blueprint $table) {
13
+        Schema::create('comment_likes', function(Blueprint $table) {
14 14
             $table->id();
15 15
             $table->foreignId('user_id')->nullable();
16 16
             $table->foreignId('comment_id');
Please login to merge, or discard this patch.
src/Providers/MarkdownServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
      */
18 18
     public function register(): void
19 19
     {
20
-        $this->app->singleton('markdown', function () {
20
+        $this->app->singleton('markdown', function() {
21 21
             $environment = new Environment([
22 22
                 'allow_unsafe_links' => false,
23 23
                 'html_input' => 'strip'
Please login to merge, or discard this patch.
migrations/2025_01_01_000001_add_comment_banned_until_to_users_table.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,14 +8,14 @@
 block discarded – undo
8 8
 {
9 9
     public function up()
10 10
     {
11
-        Schema::table('users', function (Blueprint $table) {
11
+        Schema::table('users', function(Blueprint $table) {
12 12
             $table->timestamp('comment_banned_until')->nullable()->after('remember_token');
13 13
         });
14 14
     }
15 15
 
16 16
     public function down()
17 17
     {
18
-        Schema::table('users', function (Blueprint $table) {
18
+        Schema::table('users', function(Blueprint $table) {
19 19
             $table->dropColumn('comment_banned_until');
20 20
         });
21 21
     }
Please login to merge, or discard this patch.
database/migrations/2025_12_03_000000_create_comment_reports_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
      */
11 11
     public function up(): void
12 12
     {
13
-        Schema::create('comment_reports', function (Blueprint $table) {
13
+        Schema::create('comment_reports', function(Blueprint $table) {
14 14
             $table->id();
15 15
             $table->foreignId('comment_id')->constrained()->onDelete('cascade');
16 16
             $table->foreignId('user_id')->nullable()->constrained()->onDelete('set null');
Please login to merge, or discard this patch.
src/Providers/CommentifyServiceProvider.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
      */
19 19
     public function register(): void
20 20
     {
21
-        $this->app->bind(CommentPolicy::class, function ($app) {
21
+        $this->app->bind(CommentPolicy::class, function($app) {
22 22
             return new CommentPolicy;
23 23
         });
24 24
 
@@ -36,36 +36,36 @@  discard block
 block discarded – undo
36 36
         if ($this->app->runningInConsole()) {
37 37
             // Publish config file
38 38
             $this->publishes([
39
-                __DIR__ . '/../../config/commentify.php' => config_path('commentify.php'),
39
+                __DIR__.'/../../config/commentify.php' => config_path('commentify.php'),
40 40
             ], 'commentify-config');
41 41
 
42 42
             $this->publishes([
43
-                __DIR__ . '/../../tailwind.config.js' => base_path('tailwind.config.js'),
43
+                __DIR__.'/../../tailwind.config.js' => base_path('tailwind.config.js'),
44 44
             ], 'commentify-tailwind-config');
45 45
 
46 46
             // Publish Tailwind views
47 47
             $this->publishes([
48
-                __DIR__ . '/../../resources/views/tailwind' => resource_path('views/vendor/commentify'),
48
+                __DIR__.'/../../resources/views/tailwind' => resource_path('views/vendor/commentify'),
49 49
             ], 'commentify-tailwind-views');
50 50
 
51 51
             // Publish Bootstrap views
52 52
             $this->publishes([
53
-                __DIR__ . '/../../resources/views/bootstrap' => resource_path('views/vendor/commentify'),
53
+                __DIR__.'/../../resources/views/bootstrap' => resource_path('views/vendor/commentify'),
54 54
             ], 'commentify-bootstrap-views');
55 55
 
56 56
             // Publish Filament views
57 57
             $this->publishes([
58
-                __DIR__ . '/../../resources/views/filament' => resource_path('views/vendor/commentify'),
58
+                __DIR__.'/../../resources/views/filament' => resource_path('views/vendor/commentify'),
59 59
             ], 'commentify-filament-views');
60 60
 
61 61
             // Publish language files
62 62
             $this->publishes([
63
-                __DIR__ . '/../../lang' => resource_path('../lang/vendor/commentify'),
63
+                __DIR__.'/../../lang' => resource_path('../lang/vendor/commentify'),
64 64
             ], 'commentify-lang');
65 65
 
66 66
         }
67 67
 
68
-        $migrationPath = realpath(__DIR__ . '/../../database/migrations');
68
+        $migrationPath = realpath(__DIR__.'/../../database/migrations');
69 69
         if ($migrationPath && is_dir($migrationPath)) {
70 70
             $this->loadMigrationsFrom($migrationPath);
71 71
         }
@@ -79,18 +79,18 @@  discard block
 block discarded – undo
79 79
             $framework = 'tailwind';
80 80
         }
81 81
 
82
-        $frameworkPath = __DIR__ . '/../../resources/views/' . $framework;
82
+        $frameworkPath = __DIR__.'/../../resources/views/'.$framework;
83 83
 
84 84
         if (is_dir($frameworkPath)) {
85 85
             $this->loadViewsFrom($frameworkPath, 'commentify');
86 86
         } else {
87 87
             // Fallback to tailwind if framework directory doesn't exist
88
-            $this->loadViewsFrom(__DIR__ . '/../../resources/views/tailwind', 'commentify');
88
+            $this->loadViewsFrom(__DIR__.'/../../resources/views/tailwind', 'commentify');
89 89
         }
90 90
 
91
-        $filamentPath = __DIR__ . '/../../resources/views/filament';
92
-        $filamentPathTailwind = __DIR__ . '/../../resources/views/tailwind/filament';
93
-        $filamentPathBootstrap = __DIR__ . '/../../resources/views/bootstrap/filament';
91
+        $filamentPath = __DIR__.'/../../resources/views/filament';
92
+        $filamentPathTailwind = __DIR__.'/../../resources/views/tailwind/filament';
93
+        $filamentPathBootstrap = __DIR__.'/../../resources/views/bootstrap/filament';
94 94
 
95 95
         if (is_dir($filamentPath)) {
96 96
             $this->loadViewsFrom($filamentPath, 'commentify');
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
             $this->loadViewsFrom($filamentPathBootstrap, 'commentify');
101 101
         }
102 102
 
103
-        $this->loadTranslationsFrom(__DIR__ . '/../../lang', 'commentify');
103
+        $this->loadTranslationsFrom(__DIR__.'/../../lang', 'commentify');
104 104
         Livewire::component('comments', Comments::class);
105 105
         Livewire::component('comment', Comment::class);
106 106
         Livewire::component('like', Like::class);
Please login to merge, or discard this patch.
src/Scopes/HasLikes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
 
35 35
         if ($ip && $userAgent) {
36 36
             if ($this->relationLoaded('likes')) {
37
-                return $this->likes->filter(function ($like) use ($ip, $userAgent) {
37
+                return $this->likes->filter(function($like) use ($ip, $userAgent) {
38 38
                     return $like->ip === $ip && $like->user_agent === $userAgent;
39 39
                 })->isNotEmpty();
40 40
             }
Please login to merge, or discard this patch.
src/Http/Livewire/Comment.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -162,12 +162,12 @@  discard block
 block discarded – undo
162 162
     public function selectUser($userName): void
163 163
     {
164 164
         if ($this->replyState['body']) {
165
-            $this->replyState['body'] = preg_replace('/@(\w+)$/', '@' . str_replace(' ', '_', Str::lower($userName)) . ' ',
165
+            $this->replyState['body'] = preg_replace('/@(\w+)$/', '@'.str_replace(' ', '_', Str::lower($userName)).' ',
166 166
                 $this->replyState['body']);
167 167
 //            $this->replyState['body'] =$userName;
168 168
             $this->users = [];
169 169
         } elseif ($this->editState['body']) {
170
-            $this->editState['body'] = preg_replace('/@(\w+)$/', '@' . str_replace(' ', '_', Str::lower($userName)) . ' ',
170
+            $this->editState['body'] = preg_replace('/@(\w+)$/', '@'.str_replace(' ', '_', Str::lower($userName)).' ',
171 171
                 $this->editState['body']);
172 172
             $this->users = [];
173 173
         }
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
     public function getUsers($searchTerm): void
183 183
     {
184 184
         if (!empty($searchTerm)) {
185
-            $this->users = User::where('name', 'like', '%' . $searchTerm . '%')->take(5)->get();
185
+            $this->users = User::where('name', 'like', '%'.$searchTerm.'%')->take(5)->get();
186 186
         } else {
187 187
             $this->users = [];
188 188
         }
@@ -209,13 +209,13 @@  discard block
 block discarded – undo
209 209
         $reportReasons = config('commentify.report_reasons', ['spam', 'inappropriate', 'offensive', 'other']);
210 210
         
211 211
         $this->validate([
212
-            'reportState.reason' => 'required|in:' . implode(',', $reportReasons),
212
+            'reportState.reason' => 'required|in:'.implode(',', $reportReasons),
213 213
             'reportState.additional_details' => 'nullable|max:500'
214 214
         ]);
215 215
 
216 216
         $reason = $this->reportState['reason'];
217 217
         if (!empty($this->reportState['additional_details'])) {
218
-            $reason .= ': ' . $this->reportState['additional_details'];
218
+            $reason .= ': '.$this->reportState['additional_details'];
219 219
         }
220 220
 
221 221
         $report = CommentReport::create([
Please login to merge, or discard this patch.