title: Adding data to from a database to the Index page of laravel 5.4
body: <p>I am trying to create an adverts section on my landing page of a laravel 5.4 project using data from a database but it is not working.
  in my welcome, I have added this lines of code</p>
  
  <pre><code>    foreach($adverts as $advert)   {         
                   $advert;
                  }
  </code></pre>
  
  <p>I have then created a WelcomeController with the following code
          
  
  <pre><code>    namespace App\Http\Controllers;
      use Illuminate\Support\Facades\DB;
      use Illuminate\Http\Request;
  
      class WelcomeController extends Controller
      {
  /**
   * Create a new controller instance.
   *
   * @return void
   */
  public function __construct()
   {
      $this-&gt;middleware('auth');
  }
  
  /**
   * Show the application dashboard.
   *
   * @return \Illuminate\Http\Response
   */
  public function index()
  {
      $adverts = DB::table('adverts')-&gt;get();
  
      return view('welcome', ['adverts' =&gt; $adverts]);
     }
  }
  </code></pre>
  
  <p>This gives me an error $adverts is not defined
  What could I be doing wrong?</p>