public function isLiked($user = null)
    {
        return $this->likes()->where([
            'user_id'       => $user ? $user->id : auth()->id(),
            'likeable_type' => get_class($this),
            'likeable_id'   => $this->id
        ])->first();
    }
public function isLiked($user = null)
    {
        return $this->likes()->where([
            'user_id'       => $user ? $user->id : auth()->id(),
            'likeable_type' => get_class($this),
            'likeable_id'   => $this->id
        ])->first();
    }
public function isLiked ( $ user = null ) { return $ this -> likes ( ) -> where ( [ 'user_id' => $ user ? $ user -> id : auth ( ) -> id ( ) , 'likeable_type' => get_class ( $ this ) , 'likeable_id' => $ this -> id ] ) -> first ( ) ; }
Check if likeable model is liked or not
@param null $user
@return mixed
Check if likeable model is liked or not