title: Laravel Difference `between app->bind` and `app->singleton`?
body: <p>I've been trying to figure out what the difference between <code>app-&gt;bind</code> and <code>app-&gt;singleton</code> are when setting up a service provider in Laravel. I was under the impression that if I register an <code>singleton</code> it would return the same instance of the object each time it was called vs <code>bind</code> which would be a new instance.</p>
  
  <p>Here is simple example:</p>
  
  <p>Facade:</p>
  
  <pre><code>use Illuminate\Support\Facades\Facade;
  
  class DataFacade extends Facade
  {
      protected static function getFacadeAccessor() { 
          return 'Data';
      }
  }
  </code></pre>
  
  <p>ServiceProvider:</p>
  
  <pre><code>use Illuminate\Support\ServiceProvider;
  
  class DataServiceProvider extends ServiceProvider
  {
      public function register() {
          $this-&gt;app-&gt;singleton('Data', function() {
              return new Data;
          });
      }
  }
  </code></pre>
  
  <p>Class:</p>
  
  <pre><code>class Data
  {
      public $data = [];
  
      public function get($key)
      {
          return isset($this-&gt;data[$key]) ? $this-&gt;data[$key] : null;
      }
  
      public function set($key, $val)
      {
          $this-&gt;data[$key] = $val;
      }
  }
  </code></pre>
  
  <p>If we do something like:</p>
  
  <pre><code>$instance = App::make('Data');
  $instance-&gt;set('foo', 'foo');
  
  $instance2 = App::make('Data');
  
  echo $instance-&gt;get('foo');
  echo $instance2-&gt;get('foo');
  </code></pre>
  
  <p>And run that we will see the appropriate behavior between <code>bind</code> and <code>singleton</code> with <code>foo</code> being printed out once and then twice respectively. However if we run it through the facade like so:</p>
  
  <pre><code>Data::set('test', 'test');
  Data::set('cheese', 'cheese');
  </code></pre>
  
  <p>When it's a singleton I would expect both <code>test</code> and <code>cheese</code> to be available and when it's a <code>bind</code> I'm not sure what I would expect to be available via the facade, but it seems like there is no difference.</p>
  
  <p>It's the facade treating everything as a <code>singleton</code>? </p>