title: Laravel 4 - How to access MySQL db in Views
body: <p>I'm pretty new to using frameworks . I have a school project where i need to use an MVC and i have been using laravel for around 2 weeks .</p>
  
  <p>I already setup the site structure  , authentification etc.. but i kind of hit a bump</p>
  
  <p>I have no idea with laravel ,  how to use a view access a mysql table except the user one . I read several tutorials &amp; documentation - no luck</p>
  
  <p>Such as for user details - i just use these :</p>
  
  <pre><code>{{ Auth::user()-&gt;username }}
  {{ Auth::user()-&gt;email }}
  </code></pre>
  
  <p>However i created a new model &amp; controller . I know how to create an entry into the db table but not how to access it . Here are the files below :</p>
  
  <p>Model : Course</p>
  
  <pre><code>&lt;?php
  
  class Course extends Eloquent {
  
      /* User Rules */
  
      public static $rules = array(
  
      'name'=&gt;'required|alpha|size:4',
  
      'cid'=&gt;'required|digits:3|unique:courses',
  
      'description'=&gt;'required|regex:/^[A-Za-z \t]*$/i|min:3|unique:courses',
  
      'credits'=&gt;'required|numeric'
  
      );
  
      /**
       * The database table used by the model.
       *
       * @var string
       */
      protected $table = 'courses';
  
  
  }
  </code></pre>
  
  <p>Controller : COurseController</p>
  
  <pre><code>&lt;?php
  
  class CourseController extends BaseController {
  
  
  //------------------------------------------
  
  public function addCourseView() {
      return View::make('courses.addcourse');
  }
  
  public function addCourse() {
  
      $validator = Validator::make(Input::all(), Course::$rules);
  
      if ($validator-&gt;passes()) {
  
              $course = new Course;
              $course-&gt;name = Input::get('name');
              $course-&gt;cid = Input::get('cid');
              $course-&gt;description = Input::get('description');
              $course-&gt;credits = Input::get('credits');
              $course-&gt;save();
  
              return Redirect::to('courses/add')-&gt;with('status', 'Course Added Successfully !');
      } 
      else 
      {
          return Redirect::to('courses/add')-&gt;with('error', 'Errors have occured with your inputs')-&gt;withErrors($validator)-&gt;withInput();
      }
  
  
  }
  
  
  
  }
  ?&gt;
  </code></pre>
  
  <p>Now let's say i have a view .</p>
  
  <p>How can i display the courses in the table using their name , cid ?</p>