title: "Use of undefined constant..." error in Laravel
body: <p>I am a Laravel newbie. I want to pass the results of a database query to a view. I get an error message "Use of undefined constant tasks - assumed 'tasks'". What am I doing wrong?</p>
  
  <p>My code is as follows:</p>
  
  <pre><code>class TasksController extends BaseController{
      public function index(){
          $tasks = Task::all();
  
          //return View::make(tasks.index, ['tasks' =&gt; $tasks]);
          return View::make(tasks.index, compact('tasks'));
      }
  </code></pre>
  
  <p>A snippet from my template page is shown below:</p>
  
  <pre><code>&lt;body&gt;
      &lt;h1&gt;All tasks!&lt;/h1&gt;
  
      @foreach($tasks as $task)
          &lt;li&gt;{{ $task-title }} &lt;/li&gt;
      @endforeach
  </code></pre>