title: How to get the linked table column value in view (Laravel5)?
body: <p>I am a new to laravel can anybody help?   </p>
  
  <p><strong>Tables structure</strong></p>
  
  <pre><code>1) rooms
     id |roomno |roomtype_id  |luxurytype |status
  2) roomtypes
     id| code| description 
  </code></pre>
  
  <p><strong>Models code</strong></p>
  
  <p>1) roomtype model</p>
  
  <pre><code>&lt;?php
  
  namespace App;
  use Illuminate\Database\Eloquent\Model;
  
  class roomtype extends Model
  {
   public function rooms(){
      return $this-&gt;hasMany('App\room');
   }
   }
  </code></pre>
  
  <p>2)room model</p>
  
  <pre><code> namespace App;
   use Illuminate\Database\Eloquent\Model;
  
   class room extends Model
   {
    public function roomtypes(){
      return $this-&gt;belongsTo('App\roomtype');
    }
   }
  </code></pre>
  
  <p><strong>Controller</strong> </p>
  
  <pre><code> public function index()
   {
      $roomtype = roomtype::all();
      $rooms = room::all();
     return view('home', array('roomtype'=&gt;$roomtype , 'rooms'=&gt;$rooms));
   }
  </code></pre>
  
  <p><strong>View</strong> </p>
  
  <pre><code>@foreach ($rooms as $rooms)
                  &lt;tr&gt;
                      &lt;td&gt;{{ $rooms-&gt;roomno }}&lt;/td&gt;
                      &lt;td&gt;{{ $rooms-&gt;luxurytype }}&lt;/td&gt;
                      &lt;td&gt;{{ $rooms-&gt;roomtypes-&gt;description }}&lt;/td&gt;
                      &lt;td&gt;{{ $rooms-&gt;status }}&lt;/td&gt;
                      &lt;td&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  @endforeach
  </code></pre>
  
  <p><strong>Error</strong><br>
      If I use this line <code>{{ $rooms-&gt;roomtypes-&gt;description }}</code> then am getting:</p>
  
  <blockquote>
    <p>Trying to get property of non-object<br>
         (View: C:\xampp\htdocs\hms\resources\views\home.blade.php)</p>
  </blockquote>
  
  <p>How can I show the room with its roomtype description?</p>