title: Invalid argument supplied for foreach() - laravel 5.6
body: <p>newbie here practicing laravel, im making an inventory for movies using laravel 5.6.. where I can do basic CRUD functionalities.</p>
  
  <p>In here, Im sorting movies by genre. however I came up with this error Invalid argument supplied for foreach(); </p>
  
  <p><strong>here is my Route: web.php</strong></p>
  
  <p>Route::resource('movies', 'MoviesController');</p>
  
  <p>Route::get('movies/year/{movie}', 'MoviesController@released');</p>
  
  <p>Route::get('movies/genre/{genre}', 'MoviesController@getgenre');</p>
  
  <p><strong>here is my controller: MoviesController.php</strong></p>
  
  <pre><code>public function getgenre($genre){
      $movies = Movie::where('genre', $genre)-&gt;whereIn('status', [1])-&gt;orderBy('title', 'asc')-&gt;get();
      return view('genre', compact('movies'));
  }
  </code></pre>
  
  <p><strong>here is my view: genre.blade.php</strong></p>
  
  <p>@extends('layouts.app')</p>
  
  <p>@section('content')</p>
  
  <pre><code>&lt;div class="row"&gt;
      &lt;div class="col-md-10"&gt;
          @if($movies-&gt;count() &lt; 1)
              &lt;h1 style="text-align: center"&gt;No Movie Found&lt;/h1&gt;
          @else
              @foreach($movies as $movie)
                  &lt;div class="card" style="margin-bottom: 10px;"&gt;
                      &lt;div class="card-body"&gt;
                          &lt;div class="card-title"&gt;
                              {{ ucwords($movie-&gt;title) }}
                          &lt;/div&gt;
                          &lt;div class="card-text"&gt;
                              {{ ucfirst($movie-&gt;genre) }} | {{$movie-&gt;released}} | 
  
                              @if($movie-&gt;seen == 1)
                                  Seen: Yes
                              @else
                                  Seen: No
                              @endif
  
                              &lt;div style="margin-top: 5px"&gt;
                                  {{ Form::open(['route' =&gt; ['movies.edit', $movie-&gt;id], 'class' =&gt; 'formupdate', 'method' =&gt; 'GET']) }}
                                      {{ Form::submit('Update', ['class' =&gt; 'btn btn-primary col-md-2']) }}
                                  {{ Form::close() }}
                              &lt;/div&gt;
  
                              &lt;div style="margin-top: 5px"&gt;
                                  {{ Form::open(['route' =&gt; ['movies.destroy', $movie-&gt;id], 'class' =&gt; 'formdelete', 'method' =&gt; 'DELETE']) }}
  
                                      {{ Form::hidden('hidden', 'hidden') }}
                                      {{ Form::submit('Delete', ['class' =&gt; 'btn btn-danger col-md-2']) }}
                                  {{ Form::close() }}
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              @endforeach
  
          &lt;div class="pagination" style="margin-top: 10px; text-align: center;"&gt;
              {{ $movie-&gt;links() }}
          &lt;/div&gt;
          @endif
      &lt;/div&gt;
      &lt;div class="col-md-2"&gt;
  
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>@stop</p>
  
  <p>I tested it dd(): and it has results:</p>
  
  <p><a href="https://i.stack.imgur.com/IRfpV.png" rel="nofollow noreferrer">tried testing it using dd() </a></p>
  
  <p>here is the error:
  <a href="https://i.stack.imgur.com/zX2xw.png" rel="nofollow noreferrer">here is the error</a></p>
  
  <p>thanks,</p>