Created
March 6, 2020 12:57
-
-
Save MostafaEzzelden/892010b6b292a5a704a48a51647a8514 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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