title: PHP/Laravel magic, how does this work?
body: <p>I'm looking at the Laravel docs, and I see this snippet:</p>
  
  <pre><code>class UserController extends BaseController {
  
      /**
       * The layout that should be used for responses.
       */
      protected $layout = 'layouts.master';
  
      /**
       * Show the user profile.
       */
      public function showProfile()
      {
          $this-&gt;layout-&gt;content = View::make('user.profile');
      }
  
  }
  </code></pre>
  
  <p>we can clearly see that $this->layout = 'layouts.master'.  However, then they define a child of the layout object (which as I understand is only a base PHP string, and does not have a field called content, via ...</p>
  
  <p><code>$this-&gt;layout-&gt;content = View::make('user.profile');</code></p>
  
  <ol>
  <li><p>How can a string have a field called content defined?</p></li>
  <li><p>when I subclass BaseController and try to assign a value to
  $this->layout->content, why do I get the following error: "Attempt
  to assign property of non-object"?</p></li>
  </ol>