From 14cc7005dd2caf2214daa48f180e73c1f7cb610b Mon Sep 17 00:00:00 2001 From: A1Gard Date: Fri, 26 Jul 2024 18:38:09 +0330 Subject: [PATCH] fixd bug & added approved comment --- app/Models/Clip.php | 11 +++++++++++ app/Models/Gallery.php | 11 +++++++++++ app/Models/Post.php | 4 +++- app/Models/Product.php | 2 +- .../post/SimplePost/inc/comment-detail.blade.php | 5 +++++ 5 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 resources/views/segments/post/SimplePost/inc/comment-detail.blade.php diff --git a/app/Models/Clip.php b/app/Models/Clip.php index 757906b..23d33fc 100644 --- a/app/Models/Clip.php +++ b/app/Models/Clip.php @@ -51,4 +51,15 @@ class Clip extends Model return route(''); } + + public function comments() + { + return $this->morphMany(Comment::class, 'commentable'); + } + + public function approvedComments() + { + return $this->morphMany(Comment::class, 'commentable')->where('status', 1); + } + } diff --git a/app/Models/Gallery.php b/app/Models/Gallery.php index b61c2b6..012dc62 100644 --- a/app/Models/Gallery.php +++ b/app/Models/Gallery.php @@ -74,4 +74,15 @@ class Gallery extends Model implements HasMedia return '#';// WIP return route(''); } + + + public function comments() + { + return $this->morphMany(Comment::class, 'commentable'); + } + + public function approvedComments() + { + return $this->morphMany(Comment::class, 'commentable')->where('status', 1); + } } diff --git a/app/Models/Post.php b/app/Models/Post.php index ddff782..a602166 100644 --- a/app/Models/Post.php +++ b/app/Models/Post.php @@ -98,7 +98,7 @@ class Post extends Model implements HasMedia public function approvedComments() { - return $this->morphMany(Comment::class, 'commentable')->where('status', 1); + return $this->morphMany(Comment::class, 'commentable'); } public function mainGroup(){ @@ -110,6 +110,8 @@ class Post extends Model implements HasMedia } + + // public function toArray() // { // return [ diff --git a/app/Models/Product.php b/app/Models/Product.php index 3250b49..c48a997 100644 --- a/app/Models/Product.php +++ b/app/Models/Product.php @@ -106,7 +106,7 @@ class Product extends Model implements HasMedia public function approvedComments() { - return $this->morphMany(Comment::class, 'commentable')->where('status', 1)->whereNull('sub_comment_id'); + return $this->morphMany(Comment::class, 'commentable')->where('status', 1); } public function categories() diff --git a/resources/views/segments/post/SimplePost/inc/comment-detail.blade.php b/resources/views/segments/post/SimplePost/inc/comment-detail.blade.php new file mode 100644 index 0000000..c1ab610 --- /dev/null +++ b/resources/views/segments/post/SimplePost/inc/comment-detail.blade.php @@ -0,0 +1,5 @@ +
+

+ comment +

+