From 03100d2b3adfde083aa6470ea7a1c54b74fcdf5d Mon Sep 17 00:00:00 2001 From: Arthur Monney Date: Tue, 5 Nov 2024 00:26:45 +0100 Subject: [PATCH] feat: [LAR-28] update forum feature --- .../Commands/UpdateUserBestRepliesPoints.php | 6 +- app/Http/Controllers/ThreadController.php | 30 ------- app/Livewire/{ => Components}/Forum/Reply.php | 4 +- .../{ => Components}/Forum/ReplyForm.php | 4 +- .../{ => Components}/Forum/Subscribe.php | 8 +- app/Livewire/Forum/EditThread.php | 69 -------------- app/Livewire/Pages/Forum/Channels.php | 31 +++++++ app/Livewire/Pages/Forum/Index.php | 90 +++++++++++++++++-- app/Models/Channel.php | 8 +- app/Models/Thread.php | 4 +- composer.json | 1 + composer.lock | 2 +- ..._description_columns_to_channels_table.php | 24 +++++ lang/en/notifications.php | 2 + lang/en/pages/forum.php | 1 + lang/fr/notifications.php | 2 + lang/fr/pages/forum.php | 1 + .../components/forum/channels-grid.blade.php | 29 ++++++ .../views/components/forum/thread.blade.php | 2 +- .../views/components/nav/forum-link.blade.php | 10 ++- resources/views/forum/_moderators.blade.php | 36 -------- resources/views/forum/_top-members.blade.php | 0 resources/views/forum/thread.blade.php | 19 ---- resources/views/layouts/forum.blade.php | 59 +++++++++--- .../forum/reply-form.blade.php | 0 .../{ => components}/forum/reply.blade.php | 0 .../forum/subscribe.blade.php | 0 .../livewire/modals/delete-thread.blade.php | 34 ------- .../livewire/pages/forum/channels.blade.php | 29 ++++++ .../pages/forum/detail-thread.blade.php | 6 +- .../livewire/pages/forum/index.blade.php | 2 +- routes/forum.php | 3 +- .../Livewire/Pages/Forum/DetailThreadTest.php | 2 +- 33 files changed, 283 insertions(+), 235 deletions(-) delete mode 100644 app/Http/Controllers/ThreadController.php rename app/Livewire/{ => Components}/Forum/Reply.php (96%) rename app/Livewire/{ => Components}/Forum/ReplyForm.php (96%) rename app/Livewire/{ => Components}/Forum/Subscribe.php (83%) delete mode 100644 app/Livewire/Forum/EditThread.php create mode 100644 app/Livewire/Pages/Forum/Channels.php create mode 100644 database/migrations/2024_11_04_194431_add_description_columns_to_channels_table.php create mode 100644 resources/views/components/forum/channels-grid.blade.php delete mode 100644 resources/views/forum/_moderators.blade.php delete mode 100644 resources/views/forum/_top-members.blade.php delete mode 100644 resources/views/forum/thread.blade.php rename resources/views/livewire/{ => components}/forum/reply-form.blade.php (100%) rename resources/views/livewire/{ => components}/forum/reply.blade.php (100%) rename resources/views/livewire/{ => components}/forum/subscribe.blade.php (100%) delete mode 100644 resources/views/livewire/modals/delete-thread.blade.php create mode 100644 resources/views/livewire/pages/forum/channels.blade.php diff --git a/app/Console/Commands/UpdateUserBestRepliesPoints.php b/app/Console/Commands/UpdateUserBestRepliesPoints.php index 7fc30bf3..afc4f842 100644 --- a/app/Console/Commands/UpdateUserBestRepliesPoints.php +++ b/app/Console/Commands/UpdateUserBestRepliesPoints.php @@ -7,6 +7,7 @@ use App\Gamify\Points\BestReply; use App\Models\Thread; use Illuminate\Console\Command; +use Illuminate\Support\Collection; final class UpdateUserBestRepliesPoints extends Command { @@ -18,10 +19,11 @@ public function handle(): void { $this->info('Updating users bests replies reputations...'); - $resolvedThread = Thread::resolved()->with('solutionReply')->get(); + /** @var Collection | Thread[] $resolvedThread */ + $resolvedThread = Thread::with('solutionReply')->scopes('resolved')->get(); foreach ($resolvedThread as $thread) { - givePoint(new BestReply($thread->solutionReply)); + givePoint(new BestReply($thread->solutionReply)); // @phpstan-ignore-line } $this->info('All done!'); diff --git a/app/Http/Controllers/ThreadController.php b/app/Http/Controllers/ThreadController.php deleted file mode 100644 index c99cc495..00000000 --- a/app/Http/Controllers/ThreadController.php +++ /dev/null @@ -1,30 +0,0 @@ -middleware(['auth', 'verified'], ['only' => ['create', 'edit']]); - } - - public function channel(Request $request, Channel $channel): View - { - $filter = getFilter('sortBy', ['recent', 'resolved', 'unresolved']); - $threads = Thread::forChannel($channel) - ->filter($request) - ->withviewscount() - ->orderByDesc('created_at') - ->paginate(10); - - return view('forum.index', compact('channel', 'threads', 'filter')); - } -} diff --git a/app/Livewire/Forum/Reply.php b/app/Livewire/Components/Forum/Reply.php similarity index 96% rename from app/Livewire/Forum/Reply.php rename to app/Livewire/Components/Forum/Reply.php index 33c1f8c2..b63ecd57 100644 --- a/app/Livewire/Forum/Reply.php +++ b/app/Livewire/Components/Forum/Reply.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Livewire\Forum; +namespace App\Livewire\Components\Forum; use App\Gamify\Points\BestReply; use App\Models\Reply as ReplyModel; @@ -83,6 +83,6 @@ public function solutionAction(): Action #[On('reply.save.{reply.id}')] public function render(): View { - return view('livewire.forum.reply'); + return view('livewire.components.forum.reply'); } } diff --git a/app/Livewire/Forum/ReplyForm.php b/app/Livewire/Components/Forum/ReplyForm.php similarity index 96% rename from app/Livewire/Forum/ReplyForm.php rename to app/Livewire/Components/Forum/ReplyForm.php index 943d5a58..82731778 100644 --- a/app/Livewire/Forum/ReplyForm.php +++ b/app/Livewire/Components/Forum/ReplyForm.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Livewire\Forum; +namespace App\Livewire\Components\Forum; use App\Actions\Forum\CreateReplyAction; use App\Models\Reply; @@ -116,6 +116,6 @@ public function updateReply(): void public function render(): View { - return view('livewire.forum.reply-form'); + return view('livewire.components.forum.reply-form'); } } diff --git a/app/Livewire/Forum/Subscribe.php b/app/Livewire/Components/Forum/Subscribe.php similarity index 83% rename from app/Livewire/Forum/Subscribe.php rename to app/Livewire/Components/Forum/Subscribe.php index 9bcd4986..bcffadaa 100644 --- a/app/Livewire/Forum/Subscribe.php +++ b/app/Livewire/Components/Forum/Subscribe.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Livewire\Forum; +namespace App\Livewire\Components\Forum; use App\Actions\Forum\SubscribeToThreadAction; use App\Models\Thread; @@ -23,7 +23,7 @@ public function subscribe(): void app(SubscribeToThreadAction::class)->execute($this->thread); Notification::make() - ->title(__('Vous êtes maintenant abonné à ce sujet.')) + ->title(__('notifications.thread.subscribe')) ->success() ->duration(5000) ->send(); @@ -40,7 +40,7 @@ public function unsubscribe(): void ->delete(); Notification::make() - ->title(__('Vous vous êtes désabonné de ce sujet.')) + ->title(__('notifications.thread.unsubscribe')) ->success() ->duration(5000) ->send(); @@ -51,6 +51,6 @@ public function unsubscribe(): void #[On('subscription.update')] public function render(): View { - return view('livewire.forum.subscribe'); + return view('livewire.components.forum.subscribe'); } } diff --git a/app/Livewire/Forum/EditThread.php b/app/Livewire/Forum/EditThread.php deleted file mode 100644 index 45054180..00000000 --- a/app/Livewire/Forum/EditThread.php +++ /dev/null @@ -1,69 +0,0 @@ - 'onMarkdownUpdate']; - - /** - * @var string[] - */ - protected $rules = [ - 'title' => 'required|max:75', - 'body' => 'required', - ]; - - public function mount(Thread $thread): void - { - $this->title = $thread->title; - $this->body = $thread->body; - $this->associateChannels = $this->channels_selected = old('channels', $thread->channels()->pluck('id')->toArray()); - } - - public function onMarkdownUpdate(string $content): void - { - $this->body = $content; - } - - public function store(): void - { - $this->validate(); - - $this->thread->update([ - 'title' => $this->title, - 'slug' => $this->title, - 'body' => $this->body, - ]); - - $this->thread->syncChannels($this->associateChannels); - - $this->redirectRoute('forum.show', $this->thread); - } - - public function render(): View - { - return view('livewire.forum.edit-thread', [ - 'channels' => Channel::all(), - ]); - } -} diff --git a/app/Livewire/Pages/Forum/Channels.php b/app/Livewire/Pages/Forum/Channels.php new file mode 100644 index 00000000..f9e98ed2 --- /dev/null +++ b/app/Livewire/Pages/Forum/Channels.php @@ -0,0 +1,31 @@ + Channel::query() + ->withCount('threads') + ->whereNull('parent_id') + ->get() + ->sortByDesc('threads_count'), + 'childChannels' => Channel::query() + ->withCount('threads') + ->whereNotNull('parent_id') + ->get() + ->sortByDesc('threads_count'), + ]) + ->title(__('pages/forum.navigation.channels')); + } +} diff --git a/app/Livewire/Pages/Forum/Index.php b/app/Livewire/Pages/Forum/Index.php index 91b4a9e5..1ccdcd24 100644 --- a/app/Livewire/Pages/Forum/Index.php +++ b/app/Livewire/Pages/Forum/Index.php @@ -8,8 +8,10 @@ use App\Models\Thread; use Illuminate\Contracts\View\View; use Illuminate\Database\Eloquent\Builder; +use Illuminate\Support\Facades\Auth; use Livewire\Attributes\Layout; use Livewire\Attributes\On; +use Livewire\Attributes\Url; use Livewire\Component; use Livewire\WithoutUrlPagination; use Livewire\WithPagination; @@ -20,12 +22,34 @@ final class Index extends Component use WithoutUrlPagination; use WithPagination; + #[Url(as: 'channel')] + public ?string $channel = null; + + #[Url(as: 'solved')] + public ?string $solved = null; + + #[Url(as: 'me')] + public ?string $user = null; + + #[Url(as: 'no-replies')] + public ?string $unAnswered = null; + + #[Url] + public ?string $subscribe = null; + public ?Channel $currentChannel = null; public string $search = ''; public int $perPage = 30; + public function mount(): void + { + if ($this->channel) { + $this->currentChannel = Channel::findBySlug($this->channel); + } + } + #[On('channelUpdated')] public function reloadThreads(?int $channelId): void { @@ -39,21 +63,71 @@ public function reloadThreads(?int $channelId): void $this->dispatch('render'); } - public function render(): View + protected function applySearch(Builder $query): Builder { - $query = Thread::with('channels') - ->orderByDesc('created_at'); + if ($this->search) { + return $query->where(function (Builder $query): void { + $query->where('title', 'like', '%'.$this->search.'%'); + }); + } - if ($this->currentChannel?->id) { - $query->scopes(['channel' => $this->currentChannel]); + return $query; + } + + protected function applySolved(Builder $query): Builder + { + if ($this->solved) { + return match ($this->solved) { + 'no' => $query->scopes('unresolved'), + 'yes' => $query->scopes('resolved'), + }; } - if ($this->search) { - $query->where(function (Builder $query): void { - $query->where('title', 'like', '%'.$this->search.'%'); + return $query; + } + + protected function applyAuthor(Builder $query): Builder + { + if (Auth::check() && $this->user) { + return $query->whereHas('user', function (Builder $query): void { + $query->where('user_id', Auth::id()); }); } + return $query; + } + + protected function applyChannel(Builder $query): Builder + { + if ($this->currentChannel?->id) { + return $query->scopes(['channel' => $this->currentChannel]); + } + + return $query; + } + + protected function applySubscribe(Builder $query): Builder + { + return $query; + } + + protected function applyUnAnswer(Builder $query): Builder + { + return $query; + } + + public function render(): View + { + $query = Thread::with('channels') + ->orderByDesc('created_at'); + + $query = $this->applyChannel($query); + $query = $this->applySearch($query); + $query = $this->applySolved($query); + $query = $this->applyAuthor($query); + $query = $this->applySubscribe($query); + $query = $this->applyUnAnswer($query); + $threads = $query ->scopes('withViewsCount') ->paginate($this->perPage); diff --git a/app/Models/Channel.php b/app/Models/Channel.php index aec67d7f..a8d7853a 100644 --- a/app/Models/Channel.php +++ b/app/Models/Channel.php @@ -11,11 +11,13 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\HasMany; +use Spatie\Translatable\HasTranslations; /** * @property-read int $id * @property string $name * @property string $slug + * @property array $description * @property string $color * @property int | null $parent_id */ @@ -23,17 +25,17 @@ final class Channel extends Model { use HasFactory; use HasSlug; + use HasTranslations; protected $fillable = [ 'name', 'slug', + 'description', 'parent_id', 'color', ]; - protected $withCount = [ - 'threads', - ]; + public array $translatable = ['description']; protected static function boot(): void { diff --git a/app/Models/Thread.php b/app/Models/Thread.php index 91617bb1..91db05a1 100644 --- a/app/Models/Thread.php +++ b/app/Models/Thread.php @@ -46,7 +46,7 @@ * @property int | null $resolved_by * @property User | null $resolvedBy * @property User $user - * @property Reply $solutionReply + * @property Reply | null $solutionReply * @property \Illuminate\Database\Eloquent\Collection | Channel[] $channels */ final class Thread extends Model implements Feedable, ReactableInterface, ReplyInterface, SubscribeInterface, Viewable @@ -94,7 +94,7 @@ public function replyAbleSubject(): string public function getPathUrl(): string { - return '/forum/'.$this->slug(); + return route('forum.show', $this->slug()); } public function excerpt(int $limit = 200): string diff --git a/composer.json b/composer.json index 65066a11..e32f847c 100644 --- a/composer.json +++ b/composer.json @@ -43,6 +43,7 @@ "spatie/laravel-medialibrary": "^10.10.0", "spatie/laravel-permission": "^5.10.1", "spatie/laravel-sitemap": "^6.3.1", + "spatie/laravel-translatable": "^6.8", "stevebauman/location": "^6.6.2", "symfony/http-client": "^6.3.1", "symfony/mailgun-mailer": "^6.3", diff --git a/composer.lock b/composer.lock index fda0c1b8..de7211f1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0efc9d1d67bfc842186d5b7a908935c4", + "content-hash": "c894b3d2be13a5dd5f1e496299b2d0f0", "packages": [ { "name": "abraham/twitteroauth", diff --git a/database/migrations/2024_11_04_194431_add_description_columns_to_channels_table.php b/database/migrations/2024_11_04_194431_add_description_columns_to_channels_table.php new file mode 100644 index 00000000..b236c930 --- /dev/null +++ b/database/migrations/2024_11_04_194431_add_description_columns_to_channels_table.php @@ -0,0 +1,24 @@ +json('description')->nullable(); + }); + } + + public function down(): void + { + Schema::table('channels', function (Blueprint $table): void { + $table->dropColumn('description'); + }); + } +}; diff --git a/lang/en/notifications.php b/lang/en/notifications.php index 0dcf61d5..91ddd4b9 100644 --- a/lang/en/notifications.php +++ b/lang/en/notifications.php @@ -13,6 +13,8 @@ 'updated' => 'Thread was successfully updated.', 'deleted' => 'Thread was successfully deleted.', 'best_reply' => 'You have accepted this solution as the best answer for this thread.', + 'subscribe' => 'You are now subscribed to this thread.', + 'unsubscribe' => 'You have unsubscribed from this thread.', ], 'exceptions' => [ diff --git a/lang/en/pages/forum.php b/lang/en/pages/forum.php index dd7824ab..4efa3b0d 100644 --- a/lang/en/pages/forum.php +++ b/lang/en/pages/forum.php @@ -39,5 +39,6 @@ 'report_spam' => 'Report spam', 'max_thread_length' => '100 characters maximum', 'answer_reply' => 'Answer to', + 'threads_count' => ':count messages', ]; diff --git a/lang/fr/notifications.php b/lang/fr/notifications.php index f2f925ef..dbdead6b 100644 --- a/lang/fr/notifications.php +++ b/lang/fr/notifications.php @@ -13,6 +13,8 @@ 'updated' => 'Votre sujet à été modifié.', 'deleted' => 'Le sujet a été supprimé.', 'best_reply' => 'Vous avez accepté cette solution comme meilleure réponse pour ce sujet.', + 'subscribe' => 'Vous êtes maintenant abonné à ce sujet.', + 'unsubscribe' => 'Vous vous êtes désabonné de ce sujet.', ], 'exceptions' => [ diff --git a/lang/fr/pages/forum.php b/lang/fr/pages/forum.php index fb22b526..fff63c38 100644 --- a/lang/fr/pages/forum.php +++ b/lang/fr/pages/forum.php @@ -39,5 +39,6 @@ 'report_spam' => 'Signaler un spam', 'max_thread_length' => 'Maximum de 100 caractères.', 'answer_reply' => 'Répondre au sujet', + 'threads_count' => ':count messages', ]; diff --git a/resources/views/components/forum/channels-grid.blade.php b/resources/views/components/forum/channels-grid.blade.php new file mode 100644 index 00000000..fe97956f --- /dev/null +++ b/resources/views/components/forum/channels-grid.blade.php @@ -0,0 +1,29 @@ +@props([ + 'channels', +]) + +
twMerge(['class' => 'mt-5 grid gap-4 lg:grid-cols-2']) }}> + @foreach($channels as $channel) +
+
+
+ @if($channel->color) + + @endif + + {{ $channel->name }} + + +
+ + {{ __('pages/forum.threads_count', ['count' => $channel->threads_count]) }} + +
+ @if($channel->description) +

+ {{ $channel->description }} +

+ @endif +
+ @endforeach +
diff --git a/resources/views/components/forum/thread.blade.php b/resources/views/components/forum/thread.blade.php index b7a9a6d1..9c47a765 100644 --- a/resources/views/components/forum/thread.blade.php +++ b/resources/views/components/forum/thread.blade.php @@ -2,7 +2,7 @@ 'thread', ]) -
+
diff --git a/resources/views/components/nav/forum-link.blade.php b/resources/views/components/nav/forum-link.blade.php index 8ef5740f..2ac67ef5 100644 --- a/resources/views/components/nav/forum-link.blade.php +++ b/resources/views/components/nav/forum-link.blade.php @@ -6,8 +6,12 @@ @php $activeClasses = $active - ? 'ring-1 ring-gray-200 bg-gray-100 dark:bg-gray-800 dark:ring-white/10' - : 'text-gray-600 hover:text-gray-900 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-white'; + ? 'ring-1 ring-gray-200 text-gray-900 bg-gray-100 dark:bg-gray-800 dark:text-white dark:ring-white/10' + : 'text-gray-500 hover:text-gray-900 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-white'; + + $iconClasses = $active + ? 'size-5 text-primary-600 dark:text-primary-500' + : 'size-5 text-gray-400 dark:text-gray-500'; @endphp '1.5', 'aria-hidden' => true]) + @svg($icon, $iconClasses, ['stroke-width' => '1.5', 'aria-hidden' => true]) @endif {{ $slot }} diff --git a/resources/views/forum/_moderators.blade.php b/resources/views/forum/_moderators.blade.php deleted file mode 100644 index 26ea3d9c..00000000 --- a/resources/views/forum/_moderators.blade.php +++ /dev/null @@ -1,36 +0,0 @@ -
-
-
-

Modérateurs

-
-
    - @foreach ($moderators as $moderator) -
  • -
    -
    - -
    -
    -

    - {{ $moderator->name }} -

    -

    - {{ '@' . $moderator->username }} -

    -
    - -
    -
  • - @endforeach -
-
-
-
-
diff --git a/resources/views/forum/_top-members.blade.php b/resources/views/forum/_top-members.blade.php deleted file mode 100644 index e69de29b..00000000 diff --git a/resources/views/forum/thread.blade.php b/resources/views/forum/thread.blade.php deleted file mode 100644 index ebfb41fe..00000000 --- a/resources/views/forum/thread.blade.php +++ /dev/null @@ -1,19 +0,0 @@ - - -
-
- - - @if ($thread->replies->isNotEmpty()) -
-
    - @foreach ($thread->replies as $reply) - - @endforeach -
-
- @endif -
-
-
-
diff --git a/resources/views/layouts/forum.blade.php b/resources/views/layouts/forum.blade.php index b654d8e5..b33b0b94 100644 --- a/resources/views/layouts/forum.blade.php +++ b/resources/views/layouts/forum.blade.php @@ -15,28 +15,63 @@ {{ __('pages/forum.navigation.threads') }} - + {{ __('pages/forum.navigation.channels') }} - - {{ __('pages/forum.navigation.me') }} - - - {{ __('pages/forum.navigation.following') }} - - + @auth + + {{ __('pages/forum.navigation.me') }} + + + {{ __('pages/forum.navigation.following') }} + + @endauth + - + {{ __('pages/forum.navigation.solve') }} - + {{ __('pages/forum.navigation.unresolved') }} - + {{ __('pages/forum.navigation.no_reply') }} - +
diff --git a/resources/views/livewire/forum/reply-form.blade.php b/resources/views/livewire/components/forum/reply-form.blade.php similarity index 100% rename from resources/views/livewire/forum/reply-form.blade.php rename to resources/views/livewire/components/forum/reply-form.blade.php diff --git a/resources/views/livewire/forum/reply.blade.php b/resources/views/livewire/components/forum/reply.blade.php similarity index 100% rename from resources/views/livewire/forum/reply.blade.php rename to resources/views/livewire/components/forum/reply.blade.php diff --git a/resources/views/livewire/forum/subscribe.blade.php b/resources/views/livewire/components/forum/subscribe.blade.php similarity index 100% rename from resources/views/livewire/forum/subscribe.blade.php rename to resources/views/livewire/components/forum/subscribe.blade.php diff --git a/resources/views/livewire/modals/delete-thread.blade.php b/resources/views/livewire/modals/delete-thread.blade.php deleted file mode 100644 index 9689fea3..00000000 --- a/resources/views/livewire/modals/delete-thread.blade.php +++ /dev/null @@ -1,34 +0,0 @@ - - -
-
- -
-
- -
-

- Voulez-vous vraiment supprimer ce sujet ? Toutes les réponses seront supprimées cette action est - irréversible. -

-
-
-
-
- - - - - - Confirmer - - - - Annuler - - -
diff --git a/resources/views/livewire/pages/forum/channels.blade.php b/resources/views/livewire/pages/forum/channels.blade.php new file mode 100644 index 00000000..6ece67ed --- /dev/null +++ b/resources/views/livewire/pages/forum/channels.blade.php @@ -0,0 +1,29 @@ +
+ + + {{ __('pages/forum.new_thread') }} + + + + + +
+
+

+ {{ __('Les plus gros channels') }} +

+ +
+
+

+ {{ __('Les autres channels') }} +

+ +
+
+
diff --git a/resources/views/livewire/pages/forum/detail-thread.blade.php b/resources/views/livewire/pages/forum/detail-thread.blade.php index fbd30fb4..ac5707f4 100644 --- a/resources/views/livewire/pages/forum/detail-thread.blade.php +++ b/resources/views/livewire/pages/forum/detail-thread.blade.php @@ -10,7 +10,7 @@ class="gap-2 w-full justify-center py-2.5" @auth - + @endauth @@ -90,7 +90,7 @@ class="mt-5 prose prose-primary !prose-heading-off max-w-none text-gray-500 dark @if ($thread->replies->isNotEmpty()) @foreach ($thread->replies as $reply) - + @endforeach @endif @@ -114,7 +114,7 @@ class="gap-2"

@else - + @endif @else @guest diff --git a/resources/views/livewire/pages/forum/index.blade.php b/resources/views/livewire/pages/forum/index.blade.php index 5d6d4806..9abc471b 100644 --- a/resources/views/livewire/pages/forum/index.blade.php +++ b/resources/views/livewire/pages/forum/index.blade.php @@ -13,7 +13,7 @@ class="gap-2 w-full justify-center py-2.5"
- + diff --git a/routes/forum.php b/routes/forum.php index ba7b573d..7d97be21 100644 --- a/routes/forum.php +++ b/routes/forum.php @@ -2,10 +2,9 @@ declare(strict_types=1); -use App\Http\Controllers\ThreadController; use App\Livewire\Pages\Forum; use Illuminate\Support\Facades\Route; Route::get('/', Forum\Index::class)->name('index'); -Route::get('/channels/{channel}', [ThreadController::class, 'channel'])->name('channels'); +Route::get('/channels', Forum\Channels::class)->name('channels'); Route::get('/{thread}', Forum\DetailThread::class)->name('show'); diff --git a/tests/Feature/Livewire/Pages/Forum/DetailThreadTest.php b/tests/Feature/Livewire/Pages/Forum/DetailThreadTest.php index b4942f16..e6ef6cf1 100644 --- a/tests/Feature/Livewire/Pages/Forum/DetailThreadTest.php +++ b/tests/Feature/Livewire/Pages/Forum/DetailThreadTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -use App\Livewire\Forum\ReplyForm; +use App\Livewire\Components\Forum\ReplyForm; use App\Livewire\Pages\Forum\DetailThread; use App\Models\Thread; use Livewire\Livewire;