title: Undefined variable in index.php of posts in laravel
body: <p><strong>My error:</strong>
  Undefined variable: asd (View: C:\xampp\htdocs\kproject\resources\views\posts\index.blade.php)</p>
  
  <p><strong>Controller:</strong></p>
  
  <pre><code>use App\post;
  public function index()
      {
            $asd = post::all();
          return view ('posts.index')-&gt;with('post','$asd');
      }
  </code></pre>
  
  <p><strong>Index.blade.php</strong></p>
  
  <pre><code>@extends('layout.app')
  
  
  @section('content')
      &lt;h1&gt; Peoples&lt;/h1&gt;
      &lt;hr&gt;
     @if(count($asd)&gt;0)
      @foreach($asd as $post)
  
  &lt;p&gt; {{$post-&gt;username}}  &lt;/p&gt;
  
      @endforeach
  
  @else
  &lt;p&gt; No Posts  &lt;/p&gt;
     @endif
  
  
  
  @endsection
  </code></pre>
  
  <p>I don't know why I get this error,  please help needed!</p>