title: Undefined property exception when trying to instantiate dependency from IOC container
body: <p>I'm trying to deepen my knowlade in laravel architecture.</p>
  
  <ol>
  <li><p>I have a search engine (elastic search for the sake of the example), but this search engine might change in the future. So im trying to write a container for this, so in case i'll change the engine in the future, i will have to change only the container. (I believe the termenology is factory design?)</p></li>
  <li><p>I have created a provider <code>app/providers/DataFromSearchEngine.php</code> that looks like this:</p>
  
  <pre><code>use Illuminate\Support\ServiceProvider;
  
  class DataFromSearchEngine extends ServiceProvider {
     public function boot()
     {
      //
     }
  
     public function register()
    {
      $this-&gt;app-&gt;singleton('SearchEngine', function($app) {
         return new elasticSearch; 
      });
    }
  
  }
  </code></pre></li>
  <li><p>Then i registered it in the providers array in <code>config/app.php</code> .</p>
  
  <pre><code>'providers' =&gt; [
      // providers...
  
      'App\Providers\DataFromSearchEngine'
  ],
  </code></pre></li>
  <li><p>The next step is to call <code>SearchEngine</code> from my controller:</p>
  
  <pre><code>namespace App\Http\Controllers;
  
  use App\Http\Requests;
  use App\Http\Controllers\Controller;
  use Illuminate\Http\Request;
  
  class SearchController extends Controller {
  
     protected $searchEngine;
  
     public function __construct() {
        $this-&gt;searchEngine = $this-&gt;app-&gt;make('SearchEngine');
     }
  
  }
  </code></pre></li>
  </ol>
  
  <p>But all these yields: Undefined property: <code>App\Http\Controllers\SearchController::$app</code></p>
  
  <p>Can someone explain what i'm missing?</p>