title: Invalid argument supplied for foreach() Facade\Ignition\Exceptions\ViewException
body: <p>The code runs fine without the <code>@foreach</code> statement. When it's added I get the following error:</p>
  
  <pre><code>Undefined variable: articles (View: C:\laravel\laravel\resources\views\about.blade.php)
  $articles is undefined.
  Make the variable optional in the blade template. Replace {{ $articles }} with {{ $articles ?? '' }}
  </code></pre>
  
  <p>When I add the <code>?? ''</code> it creates the error: </p>
  
  <pre><code>Facade\Ignition\Exceptions\ViewException
  Invalid argument supplied for foreach()
  </code></pre>
  
  <p>Here is the complete code for the more daring:
  <a href="https://github.com/matthoek/Articles" rel="nofollow noreferrer">https://github.com/matthoek/Articles</a></p>
  
  <p>This is my view:</p>
  
  <pre><code>        &lt;? if (is_array($articles) || is_object($articles)) ?&gt;
              {
                  @foreach ($articles ?? '' as $article)
                  {
                      &lt;li class = "first"&gt;
                          &lt;h3&gt;{{ $article-&gt;title}}&lt;/h3&gt;
                          &lt;p&gt;&lt;a href="#"&gt;{{ $article-&gt;excerpt }}&lt;/a&gt;&lt;/p&gt;          
                      &lt;/li&gt;
                  @endforeach
                  }           
              }
          &lt;/ul&gt;
  </code></pre>
  
  <p>This is my controller</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  use App\Http\Requests;
  use App\Http\Controllers\Controller;
  use App\Article;
  
  class ArticlesController extends Controller
  {
      public function index()
      {
          $articles = App/Article::latest()-&gt;get();
          //$articles = Review::all();
          //$article = Review::all();
  
          return view('articles.index',['articles'=&gt;$articles]);
          //return view('articles.index', ['articles' =&gt; $articles]);
      }
  
      public function show($id)
      {
          $article = App/Article::find($id);
  
          //return view('articles.show', ['article' =&gt; $article]);
          return view('articles.show')-&gt;with('article');
      }
  
      public function create()
      {
          return view('articles.create');
      }
  
      public function store()
      {
          //validation
  
          //clean up
          $article = new Article();
          $article-&gt;title = request('title');
          $article-&gt;excerpt = request('excerpt');
          $article-&gt;body = request('body');
          $article-&gt;save();
  
          return redirect('/articles');
      }
  
      public function edit()
      {
          return view('articles.edit');
      }
  }
  </code></pre>
  
  <p>This is the section of my routes file web.php</p>
  
  <pre><code>Route::group(['middleware' =&gt; ['web']], function () 
  {
  
      Route::get('/about', function () {
          $article = App\Article::latest()-&gt;get();
          return view('about', compact('about', 'articles'));
          //return $article;
      });
  }
  </code></pre>
  
  <p>I have changed the section of the routes file to the following but it did not seem to work.</p>
  
  <pre><code> return view('about')-&gt;with(['article'=&gt; $article]);
  </code></pre>
  
  <p>I have made sure the following was in my <code>app/Http/Kernel.php</code> in <code>middlewareGroups</code> property for <code>web</code>
  <code>\Illuminate\View\Middleware\ShareErrorsFromSession::class,</code></p>
  
  <p>I have changed the foreach loop to an each loop and I get the same error on the line:</p>
  
  <pre><code>&lt;h3&gt;{{article-&gt;title}}&lt;/h3&gt;
  </code></pre>
  
  <p>Let me know if I should post more code.</p>