From 8a9ae6ebdc0b69a67f6ed016118828f18a00fb0f Mon Sep 17 00:00:00 2001 From: Jiordi Viera Date: Sat, 26 Oct 2024 15:54:02 +0100 Subject: [PATCH 1/5] initialize branch --- app/Http/Controllers/ArticlesController.php | 4 ++-- resources/views/articles/show.blade.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/ArticlesController.php b/app/Http/Controllers/ArticlesController.php index 7b2c0dc5..486365a3 100644 --- a/app/Http/Controllers/ArticlesController.php +++ b/app/Http/Controllers/ArticlesController.php @@ -28,7 +28,7 @@ public function show(Article $article): View /** @var User $user */ $user = Auth::user(); - views($article)->record(); + views($article)->cooldown(now()->addHours(2))->record(); /** @var Article $article */ $article = Cache::remember('post-'.$article->id, now()->addHour(), fn () => $article); @@ -66,4 +66,4 @@ public function edit(Article $article): View return view('articles.edit', compact('article')); } -} +} \ No newline at end of file diff --git a/resources/views/articles/show.blade.php b/resources/views/articles/show.blade.php index b6d45894..36291c32 100644 --- a/resources/views/articles/show.blade.php +++ b/resources/views/articles/show.blade.php @@ -8,6 +8,7 @@ $next = $article->nextArticle(); $previous = $article->previousArticle(); $user = $article->user; + @endphp
From 5858a647f2f77016ca3438071846dad697e55da1 Mon Sep 17 00:00:00 2001 From: Jiordi Viera Date: Sat, 26 Oct 2024 16:39:51 +0100 Subject: [PATCH 2/5] =?UTF-8?q?correction=20de=20l'erreur=20500=20afficher?= =?UTF-8?q?=20apres=20avoir=20comment=C3=A9=20une=20discussion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Livewire/Discussions/AddComment.php | 4 +- app/helpers.php | 13 +++ resources/views/articles/show.blade.php | 103 +++++++++--------- .../views/components/articles/card.blade.php | 12 +- 4 files changed, 72 insertions(+), 60 deletions(-) diff --git a/app/Http/Livewire/Discussions/AddComment.php b/app/Http/Livewire/Discussions/AddComment.php index f0eb5b4d..a04c8713 100644 --- a/app/Http/Livewire/Discussions/AddComment.php +++ b/app/Http/Livewire/Discussions/AddComment.php @@ -51,11 +51,11 @@ public function saveComment(): void ->duration(5000) ->send(); - $this->reset(); + $this->reset('body'); } public function render(): View { return view('livewire.discussions.add-comment'); } -} +} \ No newline at end of file diff --git a/app/helpers.php b/app/helpers.php index 4aac8e3c..6691edd4 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -91,3 +91,16 @@ function route_to_reply_able(mixed $replyAble): string route('discussions.show', $replyAble->slug()); } } + +if(! function_exists('getAvatar')) { + /** + * @param $title + * @param bool $rounded + * + * @return string + */ + function getAvatar($title,bool $rounded=false): string + { + return 'https://ui-avatars.com/api/?name=' . urlencode($title). '&background=random&bold=true&format=svg&size=512&rounded='.$rounded; + } +} \ No newline at end of file diff --git a/resources/views/articles/show.blade.php b/resources/views/articles/show.blade.php index 36291c32..5f4a1e18 100644 --- a/resources/views/articles/show.blade.php +++ b/resources/views/articles/show.blade.php @@ -8,18 +8,17 @@ $next = $article->nextArticle(); $previous = $article->previousArticle(); $user = $article->user; - @endphp
-