Package Data | |
---|---|
Maintainer Username: | detatech |
Maintainer Contact: | detatechindia@gmail.com (DetaTech Computers) |
Package Create Date: | 2016-08-25 |
Package Last Update: | 2016-08-26 |
Home Page: | http://blog.detatech.in/create-repository-pattern-files-in-laravel/ |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2025-02-09 03:00:06 |
Package Statistics | |
---|---|
Total Downloads: | 30 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 1 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Create Repository Pattern Files with a single command.
composer require detatech/repository-pattern:1.0.*
$providers
array in config/app.php
$providers = [
// ... other serivce providers
DetaTech\RepositoryPattern\RepositoryPatternServiceProvider::class,
];
$ php artisan vendor:publish
You can now view the command repository:create
has been listed in the artisan list. Checkout using
$ php artisan list
Once you create the file, you have to bind it to the IoC container of the application. For that, open providers/AppServiceProvider
and inside the register
method, paste the following code:
$repositoryFileNames = [
// Whatever file name that you give while creating the file from
// the terminal that same name should come here in single quotes(')
];
foreach ($repositoryFileNames as $key => $fileName) {
// Notice the namespace..
// Keep it default if you have not changed it,
// Else, update the word _App_ with your application's namespace.
$this->app->bind(
"App\\Repositories\\Contracts\\{$fileName}Contract", "App\\Repositories\\Classes\\{$fileName}"
);
}
Failing to do the above point will give Exception:
Target [/path/to/Contract/File] is not instantiable
Done.
This package is open-sourced software licensed under the MIT license.