From 0cf04f9a0d200db252bd6dfce91aebcaf202eb64 Mon Sep 17 00:00:00 2001 From: ETY001 Date: Fri, 26 May 2017 01:58:49 +0800 Subject: [PATCH 1/4] Add the user relationship and user block --- app/Http/Controllers/Api/UserController.php | 135 ++++++++++++++++++ app/User.php | 89 ++++++++++++ app/UserRelationship.php | 31 ++++ ..._123818_create_user_relationship_table.php | 42 ++++++ 4 files changed, 297 insertions(+) create mode 100644 app/UserRelationship.php create mode 100644 database/migrations/2017_05_25_123818_create_user_relationship_table.php diff --git a/app/Http/Controllers/Api/UserController.php b/app/Http/Controllers/Api/UserController.php index de25177..368cbae 100644 --- a/app/Http/Controllers/Api/UserController.php +++ b/app/Http/Controllers/Api/UserController.php @@ -291,4 +291,139 @@ public function anyGetVerificationCode(Request $request) return ['get verification code successful']; } + + /** + * Get the user following list + * + * @return array of User model or failure info + */ + public function getFollowing() + { + if (Auth::user()->check()) { + $user = Auth::user()->user(); + return $user->following; + } else { + return response('', 404); + } + } + + /** + * Get the user's followers list + * + * @return array of User model or failure info + */ + public function getFollowers() + { + if (Auth::user()->check()) { + $user = Auth::user()->user(); + return $user->followers; + } else { + return response('', 404); + } + } + + /** + * Add a following relationship + * + * @param \Illuminate\Http\Request $request + * @return array of status model or failure info + */ + public function postFollowing(Request $request) + { + if (Auth::user()->check()) { + $user = Auth::user()->user(); + $exist = $user->following() + ->where('to_user_id', $request->toUserId) + ->first(); + if (!$exist) { + $toUser = User::findOrFail($request->toUserId); + if ($user->following()->save($toUser)) { + $result = ['status' => true]; + } else { + $result = ['status' => false]; + } + } else { + $result = ['status' => 'has_been_following']; + } + return $result; + } else { + return response('', 404); + } + } + + /** + * Is userId blocked by current user. + * + * @param \Illuminate\Http\Request $request + * @return array of status or failure info + */ + public function postIsBlock(Request $request) + { + if (Auth::user()->check()) { + $user = Auth::user()->user(); + if ($user->isBlock($request->toUserId)) { + return ['status' => true]; + } else { + return ['status' => false]; + } + } else { + return response('', 404); + } + } + + /** + * Add a block user + * + * @param \Illuminate\Http\Request $request + * @return object User model or failure info + */ + public function postBlock(Request $request) + { + if (Auth::user()->check()) { + $user = Auth::user()->user(); + if ($user->toBlock($request->toUserId)) { + return ['status' => true]; + } else { + return ['status' => false]; + } + } else { + return response('', 404); + } + } + + /** + * unblock a user + * + * @param \Illuminate\Http\Request $request + * @return object User model or failure info + */ + public function postUnBlock(Request $request) + { + if (Auth::user()->check()) { + $user = Auth::user()->user(); + if ($user->unBlock($request->toUserId)) { + return ['status' => true]; + } else { + return ['status' => false]; + } + } else { + return response('', 404); + } + } + + /** + * get block list + * + * @return array of object User model or failure info + */ + public function getBlock() + { + if (Auth::user()->check()) { + $user = Auth::user()->user(); + $blockList = $user->getBlock(); + return $blockList; + } else { + return response('', 404); + } + } } diff --git a/app/User.php b/app/User.php index 41357d5..47aee86 100644 --- a/app/User.php +++ b/app/User.php @@ -100,4 +100,93 @@ public function getAvatarAttribute($url) { return \App\Helpers\FileSystem::getFullUrl($url); } + + /** + * The user's following list + */ + public function following() + { + return $this->belongsToMany('App\User', 'user_relationship', 'from_user_id', 'to_user_id'); + } + + /** + * The user's follower list + */ + public function followers() + { + return $this->belongsToMany('App\User', 'user_relationship', 'to_user_id', 'from_user_id'); + } + + /** + * The user's relationship + */ + public function userRelationship() + { + return $this->hasMany('App\UserRelationship', 'from_user_id'); + } + + /** + * Is someone blocked by current user? + * @param int $toUserId + */ + public function isBlock($toUserId) + { + $relationship = $this->userRelationship() + ->where('to_user_id', $toUserId) + ->where('is_block', UserRelationship::BLOCKED) + ->first(); + return $relationship ? true : false; + } + + /** + * Block someone + * @param int $toUserId + */ + public function toBlock($toUserId) + { + $relationship = UserRelationship::where([ + 'from_user_id' => $this->id, + 'to_user_id' => $toUserId, + ]) + ->first(); + if (!$relationship) { + $relationship = new UserRelationship; + $relationship->from_user_id = $this->id; + $relationship->to_user_id = $toUserId; + $relationship->is_block = UserRelationship::BLOCKED; + } else { + $relationship->is_block = UserRelationship::BLOCKED; + } + return $relationship->save(); + } + + /** + * Unblock someone + * @param int $userId + */ + public function unBlock($userId) + { + $relationship = UserRelationship::where([ + 'from_user_id' => $this->id, + 'to_user_id' => $userId, + ]) + ->firstOrFail(); + $relationship->is_block = UserRelationship::UNBLOCKED; + return $relationship->save(); + } + + /** + * Get block list + */ + public function getBlock() + { + $relationship = $this->userRelationship() + ->where('from_user_id', $this->id) + ->where('is_block', UserRelationship::BLOCKED) + ->get(); + $relationship = $relationship->map(function($item){ + return $item->toUser; + }); + return $relationship; + } } diff --git a/app/UserRelationship.php b/app/UserRelationship.php new file mode 100644 index 0000000..ff78b8c --- /dev/null +++ b/app/UserRelationship.php @@ -0,0 +1,31 @@ +belongsTo('App\User', 'from_user_id'); + } + + public function toUser() + { + return $this->belongsTo('App\User', 'to_user_id'); + } +} diff --git a/database/migrations/2017_05_25_123818_create_user_relationship_table.php b/database/migrations/2017_05_25_123818_create_user_relationship_table.php new file mode 100644 index 0000000..c218ee3 --- /dev/null +++ b/database/migrations/2017_05_25_123818_create_user_relationship_table.php @@ -0,0 +1,42 @@ +increments('id'); + $table->integer('type')->unsigned()->nullable(); + $table->integer('from_user_id')->index()->unsigned(); + $table->integer('to_user_id')->index()->unsigned(); + $table->integer('is_block')->default(0); + $table->softDeletes(); + $table->timestamps(); + + $table->foreign('from_user_id')->references('id')->on('users'); + $table->foreign('to_user_id')->references('id')->on('users'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('user_relationship', function (Blueprint $table) { + $table->dropForeign('user_relationship_from_user_id_foreign'); + $table->dropForeign('user_relationship_to_user_id_foreign'); + }); + Schema::drop('user_relationship'); + } +} From 2c02f025bee19814b9e1113e247ab11f597acfb6 Mon Sep 17 00:00:00 2001 From: ETY001 Date: Fri, 26 May 2017 09:30:36 +0800 Subject: [PATCH 2/4] Add unfollowing api and relationship numbers api --- app/Http/Controllers/Api/UserController.php | 81 ++++++++++++++++++--- 1 file changed, 70 insertions(+), 11 deletions(-) diff --git a/app/Http/Controllers/Api/UserController.php b/app/Http/Controllers/Api/UserController.php index 969a8f1..8952a75 100644 --- a/app/Http/Controllers/Api/UserController.php +++ b/app/Http/Controllers/Api/UserController.php @@ -331,19 +331,55 @@ public function postFollowing(Request $request) { if (Auth::user()->check()) { $user = Auth::user()->user(); + + if ($user->id == $request->toUserId) { + $result = ['status' => 'cannot_follow_yourself']; + } else { + $exist = $user->following() + ->where('to_user_id', $request->toUserId) + ->first(); + if (!$exist) { + $toUser = User::findOrFail($request->toUserId); + if ($user->following()->attach($toUser)) { + $result = ['status' => 'success']; + } else { + $result = ['status' => 'failed']; + } + } else { + $result = ['status' => 'has_been_following']; + } + } + return $result; + } else { + return response('', 404); + } + } + + /** + * Remove a following relationship + * + * @param \Illuminate\Http\Request $request + * @return array of status model or failure info + */ + public function postUnFollowing(Request $request) + { + if (Auth::user()->check()) { + $user = Auth::user()->user(); + $exist = $user->following() ->where('to_user_id', $request->toUserId) ->first(); if (!$exist) { + $result = ['status' => 'success']; + } else { $toUser = User::findOrFail($request->toUserId); - if ($user->following()->save($toUser)) { - $result = ['status' => true]; + if ($user->following()->detach($toUser)) { + $result = ['status' => 'success']; } else { - $result = ['status' => false]; + $result = ['status' => 'failed']; } - } else { - $result = ['status' => 'has_been_following']; } + return $result; } else { return response('', 404); @@ -361,9 +397,9 @@ public function postIsBlock(Request $request) if (Auth::user()->check()) { $user = Auth::user()->user(); if ($user->isBlock($request->toUserId)) { - return ['status' => true]; + return ['status' => 'success']; } else { - return ['status' => false]; + return ['status' => 'failed']; } } else { return response('', 404); @@ -380,10 +416,13 @@ public function postBlock(Request $request) { if (Auth::user()->check()) { $user = Auth::user()->user(); + if ($user->id == $request->toUserId) { + return ['status' => 'cannot_block_yourself']; + } if ($user->toBlock($request->toUserId)) { - return ['status' => true]; + return ['status' => 'success']; } else { - return ['status' => false]; + return ['status' => 'failed']; } } else { return response('', 404); @@ -401,9 +440,9 @@ public function postUnBlock(Request $request) if (Auth::user()->check()) { $user = Auth::user()->user(); if ($user->unBlock($request->toUserId)) { - return ['status' => true]; + return ['status' => 'success']; } else { - return ['status' => false]; + return ['status' => 'failed']; } } else { return response('', 404); @@ -425,4 +464,24 @@ public function getBlock() return response('', 404); } } + + /** + * get block list + * + * @return array of relationship nums or failure info + */ + public function getRelationshipNums() + { + if (Auth::user()->check()) { + $user = Auth::user()->user(); + $result = [ + 'follower' => count($user->followers), + 'following' => count($user->following), + 'block' => count($user->getBlock()) + ]; + return $result; + } else { + return response('', 404); + } + } } From e3297a82f5b846dda2318ed2252f31ca51b3bca3 Mon Sep 17 00:00:00 2001 From: ETY001 Date: Fri, 26 May 2017 09:56:43 +0800 Subject: [PATCH 3/4] Add isFollowed Api --- app/Http/Controllers/Api/UserController.php | 24 ++++++++- app/User.php | 54 +++++++++++++-------- 2 files changed, 55 insertions(+), 23 deletions(-) diff --git a/app/Http/Controllers/Api/UserController.php b/app/Http/Controllers/Api/UserController.php index 8952a75..1453d19 100644 --- a/app/Http/Controllers/Api/UserController.php +++ b/app/Http/Controllers/Api/UserController.php @@ -386,17 +386,37 @@ public function postUnFollowing(Request $request) } } + /** + * Is userId followed by current user. + * + * @param \Illuminate\Http\Request $request + * @return array of status or failure info + */ + public function postIsFollowed(Request $request) + { + if (Auth::user()->check()) { + $user = Auth::user()->user(); + if ($user->isFollowed($request->toUserId)) { + return ['status' => 'success']; + } else { + return ['status' => 'failed']; + } + } else { + return response('', 404); + } + } + /** * Is userId blocked by current user. * * @param \Illuminate\Http\Request $request * @return array of status or failure info */ - public function postIsBlock(Request $request) + public function postIsBlocked(Request $request) { if (Auth::user()->check()) { $user = Auth::user()->user(); - if ($user->isBlock($request->toUserId)) { + if ($user->isBlocked($request->toUserId)) { return ['status' => 'success']; } else { return ['status' => 'failed']; diff --git a/app/User.php b/app/User.php index fd222a9..d404ee0 100644 --- a/app/User.php +++ b/app/User.php @@ -64,6 +64,30 @@ public function timelineComments() return $this->hasMany('App\TimelineComment', 'user_id')->orderBy('created_at', 'desc')->with('author'); } + /** + * The user's following list + */ + public function following() + { + return $this->belongsToMany('App\User', 'user_relationship', 'from_user_id', 'to_user_id'); + } + + /** + * The user's follower list + */ + public function followers() + { + return $this->belongsToMany('App\User', 'user_relationship', 'to_user_id', 'from_user_id'); + } + + /** + * The user's relationship + */ + public function userRelationship() + { + return $this->hasMany('App\UserRelationship', 'from_user_id'); + } + /* * */ @@ -93,37 +117,25 @@ public function getAvatarAttribute($url) } /** - * The user's following list - */ - public function following() - { - return $this->belongsToMany('App\User', 'user_relationship', 'from_user_id', 'to_user_id'); - } - - /** - * The user's follower list - */ - public function followers() - { - return $this->belongsToMany('App\User', 'user_relationship', 'to_user_id', 'from_user_id'); - } - - /** - * The user's relationship + * Is someone followed by current user? + * @param int $toUserId */ - public function userRelationship() + public function isFollowed($toUserId) { - return $this->hasMany('App\UserRelationship', 'from_user_id'); + $relationship = $this->userRelationship() + ->where('to_user_id', $toUserId) + ->first(); + return $relationship ? true : false; } /** * Is someone blocked by current user? * @param int $toUserId */ - public function isBlock($toUserId) + public function isBlocked($toUserId) { $relationship = $this->userRelationship() - ->where('to_user_id', $toUserId) + ->where('to_user_id', $userId) ->where('is_block', UserRelationship::BLOCKED) ->first(); return $relationship ? true : false; From af9adb088790083444726182b2871d57f2ec6828 Mon Sep 17 00:00:00 2001 From: ETY001 Date: Fri, 26 May 2017 16:53:19 +0800 Subject: [PATCH 4/4] Finish the frontend following buttons, the logic of block user form timeline and comments --- .../Controllers/Api/TimelineController.php | 8 ++ app/Http/Controllers/Api/UserController.php | 88 ++++++++----------- app/Http/Controllers/TimelineController.php | 26 +++++- app/User.php | 8 +- public/bootstrap-assets/js/application.js | 27 +++++- resources/lang/en/hc.php | 4 + resources/lang/zh-CN/hc.php | 4 + resources/views/timeline/index.blade.php | 10 ++- 8 files changed, 114 insertions(+), 61 deletions(-) diff --git a/app/Http/Controllers/Api/TimelineController.php b/app/Http/Controllers/Api/TimelineController.php index 35a517d..e18add7 100644 --- a/app/Http/Controllers/Api/TimelineController.php +++ b/app/Http/Controllers/Api/TimelineController.php @@ -58,6 +58,14 @@ public function getIndex(Request $request) if ($item->imgs) { $item->imgs = TimelineImg::getImgs($item->imgs); } + })->reject(function($item){ + if (Auth::user()->check()) { + $user = Auth::user()->user(); + //remove blocked + $timelines = $timelines->reject(function($item)use($user){ + return $user->isBlocked($item->author->id); + }); + } })->toArray(); return $timelines; diff --git a/app/Http/Controllers/Api/UserController.php b/app/Http/Controllers/Api/UserController.php index 1453d19..0d0a870 100644 --- a/app/Http/Controllers/Api/UserController.php +++ b/app/Http/Controllers/Api/UserController.php @@ -296,14 +296,10 @@ public function anyGetVerificationCode(Request $request) * * @return array of User model or failure info */ - public function getFollowing() + public function getFollowing(Request $request) { - if (Auth::user()->check()) { - $user = Auth::user()->user(); - return $user->following; - } else { - return response('', 404); - } + $user = User::findOrFail($request->input('id')); + return $user->following; } /** @@ -311,14 +307,10 @@ public function getFollowing() * * @return array of User model or failure info */ - public function getFollowers() + public function getFollowers(Request $request) { - if (Auth::user()->check()) { - $user = Auth::user()->user(); - return $user->followers; - } else { - return response('', 404); - } + $user = User::findOrFail($request->input('id')); + return $user->followers; } /** @@ -332,26 +324,23 @@ public function postFollowing(Request $request) if (Auth::user()->check()) { $user = Auth::user()->user(); - if ($user->id == $request->toUserId) { + if ($user->id == $request->input('toUserId')) { $result = ['status' => 'cannot_follow_yourself']; } else { $exist = $user->following() - ->where('to_user_id', $request->toUserId) + ->where('to_user_id', $request->input('toUserId')) ->first(); if (!$exist) { - $toUser = User::findOrFail($request->toUserId); - if ($user->following()->attach($toUser)) { - $result = ['status' => 'success']; - } else { - $result = ['status' => 'failed']; - } + $toUser = User::findOrFail($request->input('toUserId')); + $user->following()->attach($toUser); + $result = ['status' => 'success']; } else { $result = ['status' => 'has_been_following']; } } return $result; } else { - return response('', 404); + return ['status' => 'not_login']; } } @@ -367,22 +356,19 @@ public function postUnFollowing(Request $request) $user = Auth::user()->user(); $exist = $user->following() - ->where('to_user_id', $request->toUserId) + ->where('to_user_id', $request->input('toUserId')) ->first(); if (!$exist) { $result = ['status' => 'success']; } else { - $toUser = User::findOrFail($request->toUserId); - if ($user->following()->detach($toUser)) { - $result = ['status' => 'success']; - } else { - $result = ['status' => 'failed']; - } + $toUser = User::findOrFail($request->input('toUserId')); + $user->following()->detach($toUser); + $result = ['status' => 'success']; } return $result; } else { - return response('', 404); + return ['status' => 'not_login']; } } @@ -396,13 +382,13 @@ public function postIsFollowed(Request $request) { if (Auth::user()->check()) { $user = Auth::user()->user(); - if ($user->isFollowed($request->toUserId)) { + if ($user->isFollowed($request->input('toUserId'))) { return ['status' => 'success']; } else { return ['status' => 'failed']; } } else { - return response('', 404); + return ['status' => 'not_login']; } } @@ -416,13 +402,13 @@ public function postIsBlocked(Request $request) { if (Auth::user()->check()) { $user = Auth::user()->user(); - if ($user->isBlocked($request->toUserId)) { + if ($user->isBlocked($request->input('toUserId'))) { return ['status' => 'success']; } else { return ['status' => 'failed']; } } else { - return response('', 404); + return ['status' => 'not_login']; } } @@ -436,16 +422,16 @@ public function postBlock(Request $request) { if (Auth::user()->check()) { $user = Auth::user()->user(); - if ($user->id == $request->toUserId) { + if ($user->id == $request->input('toUserId')) { return ['status' => 'cannot_block_yourself']; } - if ($user->toBlock($request->toUserId)) { + if ($user->toBlock($request->input('toUserId'))) { return ['status' => 'success']; } else { return ['status' => 'failed']; } } else { - return response('', 404); + return ['status' => 'not_login']; } } @@ -459,13 +445,13 @@ public function postUnBlock(Request $request) { if (Auth::user()->check()) { $user = Auth::user()->user(); - if ($user->unBlock($request->toUserId)) { + if ($user->unBlock($request->input('toUserId'))) { return ['status' => 'success']; } else { return ['status' => 'failed']; } } else { - return response('', 404); + return ['status' => 'not_login']; } } @@ -481,7 +467,7 @@ public function getBlock() $blockList = $user->getBlock(); return $blockList; } else { - return response('', 404); + return ['status' => 'not_login']; } } @@ -490,18 +476,14 @@ public function getBlock() * * @return array of relationship nums or failure info */ - public function getRelationshipNums() + public function getRelationshipNums(Request $request) { - if (Auth::user()->check()) { - $user = Auth::user()->user(); - $result = [ - 'follower' => count($user->followers), - 'following' => count($user->following), - 'block' => count($user->getBlock()) - ]; - return $result; - } else { - return response('', 404); - } + $user = User::findOrFail($request->input('id')); + $result = [ + 'follower' => count($user->followers), + 'following' => count($user->following), + 'block' => count($user->getBlock()) + ]; + return $result; } } diff --git a/app/Http/Controllers/TimelineController.php b/app/Http/Controllers/TimelineController.php index ceb2959..5c8bd1f 100644 --- a/app/Http/Controllers/TimelineController.php +++ b/app/Http/Controllers/TimelineController.php @@ -30,9 +30,31 @@ public function __construct() public function getIndex() { $timelines = Timeline::latest()->paginate(); - $users = User::limit(5)->orderByRaw('RAND()')->get(); + if (Auth::user()->check()) { + $user = Auth::user()->user(); + //remove blocked + $timelines = $timelines->reject(function($item)use($user){ + return $user->isBlocked($item->author->id); + }); + //remove myself + $userModel = User::where('id', '!=', $user->id); + } else { + $userModel = User; + } + + $currentUser = isset($user) ? $user : null; + + $users = $userModel->limit(5) + ->orderByRaw('RAND()') + ->get(); + //remove blocked + if (Auth::user()->check()) { + $users = $users->reject(function($item)use($user){ + return $user->isBlocked($item->id); + }); + } - return view('timeline.index', compact('timelines', 'users')); + return view('timeline.index', compact('timelines', 'users', 'currentUser')); } /** diff --git a/app/User.php b/app/User.php index d404ee0..fc2d8f1 100644 --- a/app/User.php +++ b/app/User.php @@ -69,7 +69,8 @@ public function timelineComments() */ public function following() { - return $this->belongsToMany('App\User', 'user_relationship', 'from_user_id', 'to_user_id'); + return $this->belongsToMany('App\User', 'user_relationship', 'from_user_id', 'to_user_id') + ->withTimestamps(); } /** @@ -77,7 +78,8 @@ public function following() */ public function followers() { - return $this->belongsToMany('App\User', 'user_relationship', 'to_user_id', 'from_user_id'); + return $this->belongsToMany('App\User', 'user_relationship', 'to_user_id', 'from_user_id') + ->withTimestamps(); } /** @@ -135,7 +137,7 @@ public function isFollowed($toUserId) public function isBlocked($toUserId) { $relationship = $this->userRelationship() - ->where('to_user_id', $userId) + ->where('to_user_id', $toUserId) ->where('is_block', UserRelationship::BLOCKED) ->first(); return $relationship ? true : false; diff --git a/public/bootstrap-assets/js/application.js b/public/bootstrap-assets/js/application.js index 34c97b2..c86cd63 100644 --- a/public/bootstrap-assets/js/application.js +++ b/public/bootstrap-assets/js/application.js @@ -183,4 +183,29 @@ $(function () { }, 1000) } } -}) +}); + +$(function(){ + $('.tofollow').on('click', function(e){ + var that = this; + $.post('/api/user/following', {toUserId: e.target.dataset.id}, function(res){ + if (res.status == 'success') { + $(that).addClass('hidden'); + $(that).next().removeClass('hidden'); + } else { + alert(res.status); + } + }, 'json'); + }); + $('.hasfollowed').on('click', function(e){ + var that = this; + $.post('/api/user/un-following', {toUserId: e.target.dataset.id}, function(res){ + if (res.status == 'success') { + $(that).addClass('hidden'); + $(that).prev().removeClass('hidden'); + } else { + alert(res.status); + } + }, 'json'); + }); +}); diff --git a/resources/lang/en/hc.php b/resources/lang/en/hc.php index e7a4840..ba18a06 100644 --- a/resources/lang/en/hc.php +++ b/resources/lang/en/hc.php @@ -51,6 +51,10 @@ 'view all' => 'View all', 'follow' => 'Follow', 'recommended_follow_text' => 'These are active users in the community, recommend you pay attention to them', + 'has_been_following' => 'Has been following', + 'cancel_following' => 'Cancel following', + 'following' => 'Following', + 'followed' => 'Followed', // right bottom diff --git a/resources/lang/zh-CN/hc.php b/resources/lang/zh-CN/hc.php index 820cb36..db32f15 100644 --- a/resources/lang/zh-CN/hc.php +++ b/resources/lang/zh-CN/hc.php @@ -51,6 +51,10 @@ 'view all' => '查看所有', 'follow' => '关注', 'recommended_follow_text' => '这些都是社区里活跃的用户,推荐你关注他们', + 'has_been_following' => '已关注', + 'cancel_following' => '取消关注', + 'following' => '正在关注', + 'followed' => '关注者', // right bottom diff --git a/resources/views/timeline/index.blade.php b/resources/views/timeline/index.blade.php index 6f7b341..dfec0bc 100644 --- a/resources/views/timeline/index.blade.php +++ b/resources/views/timeline/index.blade.php @@ -105,6 +105,7 @@
    @foreach ($timeline->comments as $index => $comment) + @if ( $currentUser==null || ($currentUser && !$currentUser->isBlocked($comment->author->id)) )
  • @@ -115,6 +116,7 @@ {{ $comment->content }}
  • + @endif @endforeach
@endif @@ -158,8 +160,12 @@
{{ $user->nickname }}
- + +