title: Laravel: Get instance of Illuminate\Database\Capsule\Manager
body: <p>I'm looking to encapsulate functionality that can be integrated into both a Laravel 5.6 webapp and a PHP-based command-line application. The functionality involves database interactivity.</p>
  
  <p>For the sake of modularity, I decided to implement this functionality as a <a href="https://getcomposer.org/" rel="nofollow noreferrer">Composer</a> module. Within the module, a constructor accepts an instance of <code>Illuminate\Database\Capsule\Manager</code>. <a href="https://github.com/laracasts/Eloquent-Outside-of-Laravel" rel="nofollow noreferrer">I believe this to be the appropriate way to use Eloquent outside of Laravel</a>, and thus assumed it would serve as a satisfactory lowest common denominator among Laravel and the CLI-based application. (The module itself works great.)</p>
  
  <p>I am now attempting to wrap this module within a Laravel <a href="https://laravel.com/docs/5.6/providers" rel="nofollow noreferrer">Service Provider</a>, and am encountering a problem: Laravel seems to mask its underlying <code>Illuminate\Database\Capsule\Manager</code> resource behind a <code>DB</code> "<a href="https://laravel.com/docs/5.6/facades" rel="nofollow noreferrer">facade</a>", which implements only <code>static</code> methods.</p>
  
  <p>Question: within Laravel, how can I access the underlying <code>Illuminate\Database\Capsule\Manager</code> instance?</p>
  
  <p>I'll note that I've been programming for 15+ years, but am relatively new to Laravel. With that said, if my thinking here is fundamentally contrary to the "Laravel way", please let me know of other architectural options. Thanks.</p>