title: get() method is not working with eloquent relationships Laravel 5
body: <p>I have a User model and a Friend Model. In User model I have </p>
  
  <pre><code>public function friends(){
          return $this-&gt;hasMany('App\FacebookModels\Friend' ,'user_id');
      }
  </code></pre>
  
  <p>and in Friend model I have</p>
  
  <pre><code>public function user(){
          return $this-&gt;belongsTo('App\User' , 'user_id');
      }
  </code></pre>
  
  <p>I want to retrieve user's followers and this is what I am trying</p>
  
  <pre><code>    public function listFollowers($id,$name){
  
  //user_id = 1 and there are two rows in table friends for user_id 1
              $user_id = $_SERVER['REQUEST_URI'];
              $user_id =  preg_replace("/[^0-9]/","",$user_id);
              $followers = Friend::where('user_id',$user_id)-&gt;get();
              foreach($followers-&gt;user as $user){
                  echo $user-&gt;name;
              }
          }
  </code></pre>
  
  <p>but I get the following error.</p>
  
  <pre><code>ErrorException in FacebookPagesController.php line 65:
  Undefined property: Illuminate\Database\Eloquent\Collection::$user
  </code></pre>
  
  <p>Line number <code>65</code> is</p>
  
  <pre><code>foreach($followers-&gt;user as $user)
  </code></pre>
  
  <p>but when I change the <code>get()</code> to <code>first()</code>
  I get the following error</p>
  
  <pre><code>ErrorException in FacebookPagesController.php line 66:
  Trying to get property of non-object
  </code></pre>
  
  <p>line number 66 is</p>
  
  <pre><code>echo $user-&gt;name;
  </code></pre>
  
  <p>However, this works with <code>first()</code></p>
  
  <pre><code>echo $followers-&gt;user-&gt;name;
  </code></pre>
  
  <p>I am not able to understand the difference of this and why this is not working. If you can explain it that would be great for most of the people.
  This is my <code>friends table</code></p>
  
  <pre><code>Schema::create('friends', function (Blueprint $table) {
              $table-&gt;increments('id');
              $table-&gt;integer('user_id')-&gt;unsigned();
              $table-&gt;foreign('user_id')-&gt;references('id')-&gt;on('users');
              $table-&gt;integer('follower')-&gt;unsinged();
              $table-&gt;timestamps();
          });
  </code></pre>
  
  <p>and this is <code>users table</code></p>
  
  <pre><code>Schema::create('users', function (Blueprint $table) {
              $table-&gt;increments('id');
              $table-&gt;string('name');
              $table-&gt;string('email')-&gt;unique();
              $table-&gt;string('password', 60);
              $table-&gt;rememberToken();
              $table-&gt;timestamps();
          });
  </code></pre>