title: Property [x] does not exist on this collection instance
body: <p>I experience this problem when I query the database using a set of conditions. if the conditions are found in the database results are displayed but if they are not found it throws the error:</p>
  
  <blockquote>
    <p>Property [room_no] does not exist on this collection instance.</p>
  </blockquote>
  
  <p>I am trying to query my database hotel where room status is vacant and room type is as the user has specified. I have tried searching similar problems in this platform but non seem to fit my area of problem.</p>
  
  <p>I have tried to use <code>get()</code>, <code>first()</code> but non solves my problem.</p>
  
  <p>My function to check available rooms:</p>
  
  <pre><code>public function availablerooms(Request $request)
  {
      try {
              $customers = Customer::All();
              $room_type = $request-&gt;input('room_type');
              $room = Room
                          ::All()
                          -&gt;where('room_status', 'Vacant')
                          -&gt;where('room_type', $room_type);
  
              return view('admin.availablerooms')
                         -&gt;with('room', $room)
                         -&gt;with('customers', $customers);
      }
      catch (\Illuminate\Database\Eloquent\ModelNotFoundException $e)
      {
            //    
      }
  
  }
  </code></pre>
  
  <p>my code to display data:</p>
  
  <pre class="lang-html prettyprint-override"><code>@if(count($room) &gt; 0)
          @foreach($room-&gt;all() as$room)
  
              &lt;tr&gt;
                  &lt;td&gt;{{$room-&gt;id}}&lt;/td&gt;&lt;td&gt;{{$room-&gt;room_no}}&lt;/td&gt;&lt;td&gt;{{$room-&gt;room_type}}&lt;/td&gt;&lt;td&gt;{{$room-&gt;room_status}}&lt;/td&gt;
                  &lt;td&gt;
                      &lt;div class="dropdown"&gt;
                          &lt;button  type="button" onclick="set()" class="btn btn-success" data-toggle="modal" data-target="#myModal" &gt;
                              Checkin
                          &lt;/button&gt;
  
                      &lt;/div&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
  
          @endforeach
          @else
          &lt;div&gt;
              &lt;p class="text-warning"&gt; No records found with that criteria &lt;/p&gt;
          &lt;/div&gt;
      @endif
  
      &lt;/tbody&gt;
  </code></pre>
  
  <p>I expect that if records are found it displays(which it does) if not found it shows no records available.</p>