app/Models/Traits/Likeable.php
/**
     * Remove a like from this record for the given user.
     *
     * @param $user mixed - If null will use currently logged in user.
     * @throws
     */
Remove a like from this record for the given user.
@param $user mixed - If null will use currently logged in user.
@throws
Remove a like from this record for the given user . @param $user mixed - If null will use currently logged in user . @throws
public function unlike($user = null)
    {
        if (null === $user) {
            $user = auth()->user();
        }
        $like = $this->likes()->where('user_id', '=', $user->id)->first();
        if (! $like) {
            return;
        }
        $like->delete();
        if ($this->likes_count > 0) {
            $this->decrement('likes_count');
        }
    }
public function unlike ( $ user = null ) { if ( null === $ user ) { $ user = auth ( ) -> user ( ) ; } $ like = $ this -> likes ( ) -> where ( 'user_id' , '=' , $ user -> id ) -> first ( ) ; if ( ! $ like ) { return ; } $ like -> delete ( ) ; if ( $ this -> likes_count > 0 ) { $ this -> decrement ( 'likes_count' ) ; } }
Remove a like from this record for the given user.
Remove a like from this record for the given user .