@@ -21,7 +21,7 @@ |
||
| 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, |
@@ -10,7 +10,7 @@ |
||
| 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'); |
@@ -10,7 +10,7 @@ |
||
| 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'); |
@@ -17,7 +17,7 @@ |
||
| 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' |
@@ -8,14 +8,14 @@ |
||
| 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 | } |
@@ -10,7 +10,7 @@ |
||
| 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'); |
@@ -34,7 +34,7 @@ |
||
| 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 | } |
@@ -162,12 +162,12 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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([ |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | ->helperText('Supports Markdown formatting'), |
| 53 | 53 | Forms\Components\Select::make('commentable_type') |
| 54 | 54 | ->label('Commentable Type') |
| 55 | - ->options(function (Comment $record) { |
|
| 55 | + ->options(function(Comment $record) { |
|
| 56 | 56 | if ($record->commentable_type) { |
| 57 | 57 | return [$record->commentable_type => class_basename($record->commentable_type)]; |
| 58 | 58 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | public static function table(Table $table): Table |
| 69 | 69 | { |
| 70 | 70 | return $table |
| 71 | - ->modifyQueryUsing(function ($query) { |
|
| 71 | + ->modifyQueryUsing(function($query) { |
|
| 72 | 72 | return $query->withCount(['likes', 'children', 'reports']); |
| 73 | 73 | }) |
| 74 | 74 | ->columns([ |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | ->limit(50) |
| 87 | 87 | ->wrap() |
| 88 | 88 | ->searchable() |
| 89 | - ->formatStateUsing(function (Comment $record) { |
|
| 89 | + ->formatStateUsing(function(Comment $record) { |
|
| 90 | 90 | return strip_tags($record->presenter()->markdownBody()); |
| 91 | 91 | }), |
| 92 | 92 | Tables\Columns\TextColumn::make('commentable_type') |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | Tables\Columns\TextColumn::make('parent_id') |
| 107 | 107 | ->label('Parent ID') |
| 108 | 108 | ->sortable() |
| 109 | - ->toggleable(isToggledHiddenByDefault: true), |
|
| 109 | + ->toggleable(isToggledHiddenByDefault : true), |
|
| 110 | 110 | Tables\Columns\TextColumn::make('likes_count') |
| 111 | 111 | ->label('Likes') |
| 112 | 112 | ->sortable() |
@@ -129,15 +129,15 @@ discard block |
||
| 129 | 129 | Tables\Columns\TextColumn::make('created_at') |
| 130 | 130 | ->dateTime() |
| 131 | 131 | ->sortable() |
| 132 | - ->toggleable(isToggledHiddenByDefault: true), |
|
| 132 | + ->toggleable(isToggledHiddenByDefault : true), |
|
| 133 | 133 | Tables\Columns\TextColumn::make('updated_at') |
| 134 | 134 | ->dateTime() |
| 135 | 135 | ->sortable() |
| 136 | - ->toggleable(isToggledHiddenByDefault: true), |
|
| 136 | + ->toggleable(isToggledHiddenByDefault : true), |
|
| 137 | 137 | Tables\Columns\TextColumn::make('deleted_at') |
| 138 | 138 | ->dateTime() |
| 139 | 139 | ->sortable() |
| 140 | - ->toggleable(isToggledHiddenByDefault: true) |
|
| 140 | + ->toggleable(isToggledHiddenByDefault : true) |
|
| 141 | 141 | ->label('Deleted At'), |
| 142 | 142 | ]) |
| 143 | 143 | ->filters([ |
@@ -148,8 +148,8 @@ discard block |
||
| 148 | 148 | Tables\Filters\TernaryFilter::make('isParent') |
| 149 | 149 | ->label('Parent Comments Only') |
| 150 | 150 | ->queries( |
| 151 | - true: fn ($query) => $query->whereNull('parent_id'), |
|
| 152 | - false: fn ($query) => $query->whereNotNull('parent_id'), |
|
| 151 | + true : fn ($query) => $query->whereNull('parent_id'), |
|
| 152 | + false : fn ($query) => $query->whereNotNull('parent_id'), |
|
| 153 | 153 | ), |
| 154 | 154 | Tables\Filters\TrashedFilter::make(), |
| 155 | 155 | ]) |