title: Undefined variable: users (View: \resources\views\home.blade.php)
body: <p>hi m trying to get some data (all user names) from users table in dropdown but it gives error: Undefined variable: users</p>
  
  <p>controller:</p>
  
  <pre><code>  public function show($id)
    {
      $data = File::findOrFail($id);
  
      //$files = \DB::table('files')-&gt;get();
      $users = \DB::table('users')-&gt;get();
  
      return view('userhome', compact('data', /*'files',*/ 'users'));
    }
  </code></pre>
  
  <p>blade file:</p>
  
  <pre><code>  &lt;div class="form-group"&gt;
                      &lt;label class="text-left"&gt;Select Student&lt;/label&gt;
                      &lt;select name="parent_id"&gt;
                          &lt;option value=""&gt;Select parent&lt;/option&gt;
                          @foreach ($users as $user)
                  &lt;option value="{{ $user-&gt;id }}"&gt;{{ $user-&gt;name }}&lt;/option&gt;
                          @endforeach
                      &lt;/select&gt;
                  &lt;/div&gt;
  </code></pre>
  
  <p>routes:</p>
  
  <pre><code>  Auth::routes();
  
    Route::group(['middleware' =&gt; ['auth']], function(){
  
    Route::get('/home', 'HomeController@index');
  
    Route::resource('file','FileController');
  
    });
  </code></pre>
  
  <p>how to solve it?</p>