title: Laravel 5: in_array() expects parameter 2 to be array, object given
body: <p>I am trying to pass an array with the logged-in user's votes on the posts from the controller to the view but I keep getting this error</p>
  
  <blockquote>
    <p>in_array() expects parameter 2 to be array, object given (View:
    C:\xampp\htdocs\laravel-5\resources\views\subreddit\show.blade.php)</p>
  </blockquote>
  
  <p>I have tried to use <code>lists()</code> but I got this error instead <code>Missing argument 1 for Illuminate\Database\Eloquent\Builder::lists()</code></p>
  
  <p>Using <code>lists('post_id')</code> returns the same error in the title.</p>
  
  <p>Controller </p>
  
  <pre><code>public function show(Subreddit $subreddit)
  {
      $posts = Subreddit::findOrFail($subreddit-&gt;id)-&gt;posts()-&gt;get();
      $votes = Auth::user()-&gt;votes()-&gt;get(); //I have also tried lists()
  
      return view('subreddit/show')
          -&gt;with('subreddit', $subreddit)
          -&gt;with('posts', $posts)
          -&gt;with('votes', $votes);
  }
  </code></pre>
  
  <p>View</p>
  
  <pre><code>@foreach($posts as $post)
      @if ($voted = in_array($post-&gt;id, $votes))
        {!! Form::open(['url' =&gt; 'votes', 'class' =&gt; 'votes']) !!}
      @endif
        &lt;div class="upvote topic" data-post="{{ $post-&gt;id }}"&gt;
           &lt;a class="upvote vote {{ $voted ? 'voted-on' : '' }}" data-value="1"&gt;&lt;/a&gt;
           &lt;span class="count"&gt;0&lt;/span&gt;
           &lt;a class="downvote vote {{ $voted ? 'downvoted-on' : '' }}" data-value="-1"&gt;&lt;/a&gt;
        &lt;/div&gt;
      {!! Form::close() !!}
  </code></pre>