title: Laravel: Undefined variable in blade view
body: <p>This is <code>AdminController.php</code>:</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use Response;
  
  use Illuminate\Support\Facades\DB;
  use App\Caption;
  use App\Image;
  use App\Http\Controllers\Controller;
  
  class AdminController extends Controller
  {
      public function admin() {
          $images = Image::paginate();
  
          return view('admin',[ '$images' =&gt; $images]);
      }
  }
  </code></pre>
  
  <p>And this is <code>admin.blade.php</code>:</p>
  
  <pre><code>@extends('template')
  
  @section('title')
      Admin Page
  @endsection
  
  @section('header')
  @endsection
  
  @section('main')
      @if (Auth::check())
          @foreach ($images as $image)
              &lt;p value='{{$image-&gt;id}}'&gt;{{$image-&gt;content}}&lt;/p&gt;
              &lt;form action="image/{{$image-&gt;id}}/delete" method="post"&gt;
                  &lt;button type="submit"&gt;Delete caption&lt;/button&gt;
              &lt;/form&gt; 
              &lt;form action="image/{{$image-&gt;id}}/approve" method="post"&gt;
                  &lt;button type="submit"&gt;Accept image&lt;/button&gt;
              &lt;/form&gt;
          @endforeach
      @else
          &lt;p&gt;Login first&lt;/p&gt;
      @endif
  @endsection
  
  @section('footer')
  @endsection
  </code></pre>
  
  <p>Why do I get the following error?</p>
  
  <blockquote>
    <p>ErrorException in 408148d5409ae6eebf768dc5721bd0d1d9af48af.php line 9:
    Undefined variable: images (View: /Users/sahandz/Documents/School/Singapore/CS3226/backend/resources/views/admin.blade.php)</p>
  </blockquote>
  
  <p><code>$images</code>is clearly defined in my controller.</p>