title: Trying to get property of non-object ({{$perfil->id}}) - Laravel Error
body: <p>I have this controller function:</p>
  
  <pre><code>public function show($id)
  {
      $perfil = DB::select('SELECT * FROM tb_perfis WHERE id='.$id.';');
      return view('perfis.show')-&gt;with('perfil', $perfil);
  }
  </code></pre>
  
  <p>This view:</p>
  
  <pre><code>@extends('layouts.app')
  
  @section('content')
  &lt;div class="container"&gt;
      &lt;div class="row"&gt;
          &lt;div class="col-md-8 col-md-offset-2"&gt;
              &lt;div class="panel panel-default"&gt;
                  &lt;div class="panel-heading"&gt;&lt;/div&gt;
                  &lt;div class="panel-body"&gt;
                      {{$perfil-&gt;id}}
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  @endsection
  </code></pre>
  
  <p>And i get the error:</p>
  
  <pre><code>"Trying to get property of non-object (View: /home/alexandre/Documents/PAP Hidroponia/pap/resources/views/perfis/show.blade.php)"
  </code></pre>
  
  <p>Why is this happening, in other pages has no problem.</p>