title: How do I access a global model instance in laravel 4?
body: <p>In Laravel 4, how do I create an instance of a model and make it globally available? Even in views. I'm looking to do something similar to the way you get the User instance using  Auth::User->name (the syntax I mean, not storing in a session) but in this case it would be ModelName::DefaultEntity->attribute.</p>
  
  <p>A little more detail...</p>
  
  <p>I am writing an application that will house multiple websites - a bit like a CMS. So I have a Website model. Each Website model will have a URL attribute so that when a user visits the URL the application can retrieve the Website model from the database and brand the website appropriately e.g. Title, logo, theme, etc...</p>
  
  <p>I would like the current Website model to be available everywhere without having to create a new instance of Website in every controller/method. So in my layouts and views I could just say something like:</p>
  
  <pre><code>{{ Website::Website()-&gt;name }}
  </code></pre>
  
  <p>or </p>
  
  <pre><code>{{ CurrentWebsite::name }}
  </code></pre>
  
  <p>I have achieved the first one by making a static method in the Website model:</p>
  
  <pre><code>public static function current()
  {
      return Website::find(1); // just to test it for now
  } 
  </code></pre>
  
  <p>But with that, it will have to do a database query every time I say:</p>
  
  <pre><code>{{ Website::current()-&gt;name }}
  </code></pre>
  
  <p>Plus it doesn't feel right.</p>
  
  <p>Can anyone help?</p>
  
  <p>Kind regards,</p>
  
  <p>Robin</p>