Skip to content

Instantly share code, notes, and snippets.

@MostafaEzzelden
Created March 6, 2020 12:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MostafaEzzelden/892010b6b292a5a704a48a51647a8514 to your computer and use it in GitHub Desktop.
Save MostafaEzzelden/892010b6b292a5a704a48a51647a8514 to your computer and use it in GitHub Desktop.
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class RepositoriesServiceProvider extends ServiceProvider
{
/**
* Repositories Name Space
*/
const REPOSITORIES_NAME_SPACE = "App\\Repository";
/**
* Repositories Name
*
* @var array
*/
protected $repositories = [
'Book',
'Chart',
'Expense',
'Notification',
];
/**
* Register services.
*
* @return void
*/
public function register()
{
foreach ($this->repositories as $repo) {
$this->app->bind(
self::REPOSITORIES_NAME_SPACE . "\\" . ($repo . "Contract"),
self::REPOSITORIES_NAME_SPACE . "\\" . ($repo . "Entity")
);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment