Remove the option to follow yourself

This commit is contained in:
Hyleus
2017-12-13 17:00:31 +01:00
parent e58563c88e
commit e19e1bcf87
+3 -1
View File
@@ -31,7 +31,9 @@ class FollowController extends Controller
*/
public function follow(User $user)
{
if (!Auth::user()->isFollowing($user->id)) {
if (Auth::user()->id == $user->id) {
return back()->with(Toastr::error("Nice try, but sadly you can not follow yourself.", 'Error!', ['options']));
} elseif (!Auth::user()->isFollowing($user->id)) {
// Create a new follow instance for the authenticated user
Auth::user()->follows()->create([
'target_id' => $user->id,