title: How to use relationships in controllers with laravel for retrieving data?
body: <p>I have the model which creates a one to many relationship between user and comment:</p>
  
  <pre><code>&lt;?php
  namespace App;
  use Illuminate\Database\Eloquent\Model;
  class comment extends Model
  {
      public function user()
      {
          return $this-&gt;belongsTo('App\User');
      }
  }
  </code></pre>
  
  <p>How can I use the model within controller by using DB to get use of the model functionality(relationship)?</p>
  
  <p>Instead of using the routes:</p>
  
  <pre><code>Route::get('/test', function(){
  $Comments = App\Comment::all();
  return view('Commentss', ['Comments' =&gt; $Comments]);
  });
  </code></pre>
  
  <p>I want to use the controller but doesn't work?</p>
  
  <pre><code>$Comments = DB::table('comments')-&gt;get(); (is there a way to use DB with model)
  
  Or 
  
  use App\Comment;
  $Comments = App\Comment::all(); (this says Class 'App\Http\Controllers\App\Comment' not found)
  </code></pre>
  
  <p>So that in the end I can retrieve the data in view by:</p>
  
  <pre><code>&lt;p&gt;{{$Comment-&gt;user-&gt;whatever}}&lt;/p&gt;
  </code></pre>