Passed
Push — main ( 17b0d5...88cc6f )
by Usama
04:11
created
database/migrations/2025_12_25_170921_add_is_approved_to_comments_table.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
      */
12 12
     public function up(): void
13 13
     {
14
-        Schema::table('comments', function (Blueprint $table) {
14
+        Schema::table('comments', function(Blueprint $table) {
15 15
             $table->boolean('is_approved')->default(false)->after('body');
16 16
             $table->index('is_approved');
17 17
         });
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      */
23 23
     public function down(): void
24 24
     {
25
-        Schema::table('comments', function (Blueprint $table) {
25
+        Schema::table('comments', function(Blueprint $table) {
26 26
             $table->dropIndex(['is_approved']);
27 27
             $table->dropColumn('is_approved');
28 28
         });
Please login to merge, or discard this patch.
src/Providers/CommentifyServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 {
15 15
     public function register(): void
16 16
     {
17
-        $this->app->bind(CommentPolicy::class, function ($app) {
17
+        $this->app->bind(CommentPolicy::class, function($app) {
18 18
             return new CommentPolicy;
19 19
         });
20 20
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         $framework = $config->get('commentify.css_framework', 'tailwind');
70 70
 
71 71
         // Validate framework value
72
-        if (! in_array($framework, ['tailwind', 'bootstrap'])) {
72
+        if (!in_array($framework, ['tailwind', 'bootstrap'])) {
73 73
             $framework = 'tailwind';
74 74
         }
75 75
 
Please login to merge, or discard this patch.
src/Http/Livewire/Comments.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
             ->with([
56 56
                 'user',
57 57
                 'likes',
58
-                'children' => function ($query) use ($requireApproval) {
58
+                'children' => function($query) use ($requireApproval) {
59 59
                     $query->with([
60 60
                         'user',
61 61
                         'likes',
62
-                        'children' => function ($nestedQuery) use ($requireApproval) {
62
+                        'children' => function($nestedQuery) use ($requireApproval) {
63 63
                             $nestedQuery->with('user', 'likes');
64 64
                             if ($requireApproval) {
65 65
                                 $nestedQuery->approved();
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
         $comment->user()->associate(auth()->user());
119 119
 
120 120
         // Set approval status based on config
121
-        $comment->is_approved = ! config('commentify.require_approval', false);
121
+        $comment->is_approved = !config('commentify.require_approval', false);
122 122
 
123 123
         $comment->save();
124 124
 
Please login to merge, or discard this patch.
src/Http/Livewire/Comment.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
     public function updatedIsEditing($isEditing): void
57 57
     {
58
-        if (! $isEditing) {
58
+        if (!$isEditing) {
59 59
             return;
60 60
         }
61 61
         $this->editState = [
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
         $this->authorize('create', \Usamamuneerchaudhary\Commentify\Models\Comment::class);
123 123
 
124
-        if (! $this->comment->isParent()) {
124
+        if (!$this->comment->isParent()) {
125 125
             return;
126 126
         }
127 127
         $this->validate([
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         $reply->commentable()->associate($this->comment->commentable);
133 133
 
134 134
         // Set approval status based on config
135
-        $reply->is_approved = ! config('commentify.require_approval', false);
135
+        $reply->is_approved = !config('commentify.require_approval', false);
136 136
 
137 137
         $reply->save();
138 138
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
     #[On('getUsers')]
162 162
     public function getUsers($searchTerm): void
163 163
     {
164
-        if (! empty($searchTerm)) {
164
+        if (!empty($searchTerm)) {
165 165
             $this->users = User::where('name', 'like', '%'.$searchTerm.'%')->take(5)->get();
166 166
         } else {
167 167
             $this->users = [];
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 
171 171
     public function reportComment(): void
172 172
     {
173
-        if (! config('commentify.enable_reporting', true)) {
173
+        if (!config('commentify.enable_reporting', true)) {
174 174
             return;
175 175
         }
176 176
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
         ]);
193 193
 
194 194
         $reason = $this->reportState['reason'];
195
-        if (! empty($this->reportState['additional_details'])) {
195
+        if (!empty($this->reportState['additional_details'])) {
196 196
             $reason .= ': '.$this->reportState['additional_details'];
197 197
         }
198 198
 
Please login to merge, or discard this patch.
src/Filament/Resources/CommentResource.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
                     ->helperText('Supports Markdown formatting'),
54 54
                 Forms\Components\Select::make('commentable_type')
55 55
                     ->label('Commentable Type')
56
-                    ->options(function (Comment $record) {
56
+                    ->options(function(Comment $record) {
57 57
                         if ($record->commentable_type) {
58 58
                             return [$record->commentable_type => class_basename($record->commentable_type)];
59 59
                         }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     public static function table(Table $table): Table
74 74
     {
75 75
         return $table
76
-            ->modifyQueryUsing(function ($query) {
76
+            ->modifyQueryUsing(function($query) {
77 77
                 return $query->withCount(['likes', 'children', 'reports']);
78 78
             })
79 79
             ->columns([
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
                     ->limit(50)
92 92
                     ->wrap()
93 93
                     ->searchable()
94
-                    ->formatStateUsing(function (Comment $record) {
94
+                    ->formatStateUsing(function(Comment $record) {
95 95
                         return strip_tags($record->presenter()->markdownBody());
96 96
                     }),
97 97
                 Tables\Columns\TextColumn::make('commentable_type')
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
                 Tables\Columns\TextColumn::make('parent_id')
112 112
                     ->label('Parent ID')
113 113
                     ->sortable()
114
-                    ->toggleable(isToggledHiddenByDefault: true),
114
+                    ->toggleable(isToggledHiddenByDefault : true),
115 115
                 Tables\Columns\TextColumn::make('likes_count')
116 116
                     ->label('Likes')
117 117
                     ->sortable()
@@ -139,15 +139,15 @@  discard block
 block discarded – undo
139 139
                 Tables\Columns\TextColumn::make('created_at')
140 140
                     ->dateTime()
141 141
                     ->sortable()
142
-                    ->toggleable(isToggledHiddenByDefault: true),
142
+                    ->toggleable(isToggledHiddenByDefault : true),
143 143
                 Tables\Columns\TextColumn::make('updated_at')
144 144
                     ->dateTime()
145 145
                     ->sortable()
146
-                    ->toggleable(isToggledHiddenByDefault: true),
146
+                    ->toggleable(isToggledHiddenByDefault : true),
147 147
                 Tables\Columns\TextColumn::make('deleted_at')
148 148
                     ->dateTime()
149 149
                     ->sortable()
150
-                    ->toggleable(isToggledHiddenByDefault: true)
150
+                    ->toggleable(isToggledHiddenByDefault : true)
151 151
                     ->label('Deleted At'),
152 152
             ])
153 153
             ->filters([
@@ -158,15 +158,15 @@  discard block
 block discarded – undo
158 158
                 Tables\Filters\TernaryFilter::make('isParent')
159 159
                     ->label('Parent Comments Only')
160 160
                     ->queries(
161
-                        true: fn ($query) => $query->whereNull('parent_id'),
162
-                        false: fn ($query) => $query->whereNotNull('parent_id'),
161
+                        true : fn ($query) => $query->whereNull('parent_id'),
162
+                        false : fn ($query) => $query->whereNotNull('parent_id'),
163 163
                     ),
164 164
                 Tables\Filters\TernaryFilter::make('is_approved')
165 165
                     ->label('Approval Status')
166 166
                     ->placeholder('All Comments')
167 167
                     ->queries(
168
-                        true: fn ($query) => $query->where('is_approved', true),
169
-                        false: fn ($query) => $query->where('is_approved', false),
168
+                        true : fn ($query) => $query->where('is_approved', true),
169
+                        false : fn ($query) => $query->where('is_approved', false),
170 170
                     ),
171 171
                 Tables\Filters\TrashedFilter::make(),
172 172
             ])
@@ -178,8 +178,8 @@  discard block
 block discarded – undo
178 178
                     ->icon('heroicon-o-check-circle')
179 179
                     ->color('success')
180 180
                     ->requiresConfirmation()
181
-                    ->visible(fn (Comment $record) => ! $record->is_approved)
182
-                    ->action(function (Comment $record) {
181
+                    ->visible(fn (Comment $record) => !$record->is_approved)
182
+                    ->action(function(Comment $record) {
183 183
                         $record->update(['is_approved' => true]);
184 184
                     }),
185 185
                 Action::make('disapprove')
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                     ->color('danger')
189 189
                     ->requiresConfirmation()
190 190
                     ->visible(fn (Comment $record) => $record->is_approved)
191
-                    ->action(function (Comment $record) {
191
+                    ->action(function(Comment $record) {
192 192
                         $record->update(['is_approved' => false]);
193 193
                     }),
194 194
                 DeleteAction::make(),
@@ -201,8 +201,8 @@  discard block
 block discarded – undo
201 201
                         ->icon('heroicon-o-check-circle')
202 202
                         ->color('success')
203 203
                         ->requiresConfirmation()
204
-                        ->action(function ($records) {
205
-                            $records->each(function (Comment $record) {
204
+                        ->action(function($records) {
205
+                            $records->each(function(Comment $record) {
206 206
                                 $record->update(['is_approved' => true]);
207 207
                             });
208 208
                         })
@@ -212,8 +212,8 @@  discard block
 block discarded – undo
212 212
                         ->icon('heroicon-o-x-circle')
213 213
                         ->color('danger')
214 214
                         ->requiresConfirmation()
215
-                        ->action(function ($records) {
216
-                            $records->each(function (Comment $record) {
215
+                        ->action(function($records) {
216
+                            $records->each(function(Comment $record) {
217 217
                                 $record->update(['is_approved' => false]);
218 218
                             });
219 219
                         })
Please login to merge, or discard this patch.