app/Models/Traits/Likeable.php
/**
     * Has the currently logged in user already "liked" the current object
     *
     * @param string $user
     * @return boolean
     */
Has the currently logged in user already "liked" the current object
@param string $user
@return boolean
Has the currently logged in user already " liked " the current object @param string $user @return boolean
public function liked($user = null)
    {
        if (null === $user) {
            $user = auth()->user();
        }
        if (! $user) {
            return false;
        }
        return (bool) $this->likes()->where('user_id', '=', $user->id)->count();
    }
public function liked ( $ user = null ) { if ( null === $ user ) { $ user = auth ( ) -> user ( ) ; } if ( ! $ user ) { return false ; } return ( bool ) $ this -> likes ( ) -> where ( 'user_id' , '=' , $ user -> id ) -> count ( ) ; }
Has the currently logged in user already "liked" the current object
 @param string $user
 @return boolean
Has the currently logged in user already " liked " the current object @param string $user @return boolean