title: add new attribute to laravel eloquent collection
body: <p>I would like to push in my eloquent model an extra attribute on calculation
  and I would like to use it in my blade as <code>$user-&gt;avatarImg</code>
  my model method look like</p>
  
  <pre><code> public function avatarImg()
   {
  
       if($this-&gt;hasMedia('avatar')) {
           $image = $this-&gt;getMedia('avatar');
           $img = \Intervention\Image\ImageManagerStatic::make($image[0]-&gt;getPath())-&gt;encode('data-url');
       }
       elseif ($this-&gt;blob-&gt;file) {
           $img = 'data:image/jpeg;base64,'. base64_encode($this-&gt;blob-&gt;file);
       } else {
           $img = '';
       }
  
  
       $this-&gt;user-&gt;put('avatarImg', $img);
  
       dd($this-&gt;user);
  
       return $img;
  
   }
  </code></pre>
  
  <p>but what I try does not working I get:</p>
  
  <pre><code>Call to a member function put() on null 
  </code></pre>
  
  <p>how would I do this properly?</p>