title: Creating Laravel repositories and binding as service providers
body: <p>I have a Symfony and Spring background, this is my first project with Laravel and as far as I understood Laravel doesn't have a build-in support for repositories. I found several tutorials; some of them try to offer architecture like Spring or Symfony. </p>
  
  <p>As an example this blog <a href="https://dev.to/asperbrothers/laravel-repository-pattern-how-to-use-why-it-matters-1g9d" rel="noreferrer">suggests an folder structure</a> like this:</p>
  
  <pre><code>---- Repository
  ------ Eloquent
  -------- UserRepository.php // extends BaseRepository
  -------- BaseRepository.php // implements EloquentRepositoryInterface
  ------ UserRepositoryInterface.php
  ------ EloquentRepositoryInterface.php 
  </code></pre>
  
  <p>which is not bad. The point I'm confused is, the author suggests to bind these repositories as service providers and access them in controller as providers. </p>
  
  <pre><code>class RepositoryServiceProvider extends ServiceProvider 
  {  
      public function register() 
      { 
          $this-&gt;app-&gt;bind(EloquentRepositoryInterface::class, BaseRepository::class);
          $this-&gt;app-&gt;bind(UserRepositoryInterface::class, UserRepository::class);
      }
  }
  </code></pre>
  
  <p>Than I decided to find a library in Github which focuses on creating an Eloquent Repository, which directly consumes User repository in controller:</p>
  
  <pre><code>class HomeController extends Controller
  {
      public function index(UserRepository $userRepository)
      {
          return $userRepository-&gt;get();
          ...
  </code></pre>
  
  <p>From architectural perspective, <strong>do we need to bind repositories as providers</strong>? (Let's think the fact that AWS or Elastic Search may join the project and repositories may vary for a single model)</p>
  
  <p>And most importantly why doesn't Laravel have a built-in repository pattern support?
  Thank you</p>