title: Laravel - Undefined variable $data on view
body: <p>I have a problem with this.</p>
  
  <blockquote>
    <p>Undefined variable: acara (View:
    /var/www/html/event_organizer/resources/views/admin/home.blade.php)</p>
  </blockquote>
  
  <p>But I have declared $acara on the controller like this</p>
  
  <p><strong>Controller</strong> </p>
  
  <pre><code>use App\events; 
  
      public function lihat_acara()
      {
        $data['acara'] = events::all();
        return view('admin.home')-&gt;with($data);
      }
  </code></pre>
  
  <p>and the view like this</p>
  
  <p><strong>home.blade.php</strong></p>
  
  <pre><code>@foreach($acara as $key)
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;td&gt;{{ $key-&gt;nama_acara }}&lt;/td&gt;
        &lt;td&gt;{{ $key-&gt;kategori_acara }}&lt;/td&gt;
        &lt;td&gt;{{ $key-&gt;lokasi_acara }}&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
    @endforeach
  </code></pre>
  
  <p>What's wrong with my code? Any idea? :)</p>