@@ -7,15 +7,23 @@ composer require nanvaie/database-repository --dev
7
7
```
8
8
9
9
### Setup for Laravel
10
- Navigate to ` app .php` in ` config ` folder and add following line in 'provider' section :
10
+ Navigate to ` AppServiceProvider .php` in ` app/Providers ` folder and add following code snippet (or it's equivalent) in 'register' function :
11
11
``` php
12
- Nanvaie\DatabaseRepository\DatabaseRepositoryServiceProvider::class
12
+ // snip
13
+ if ($this->app->environment('local', 'testing')) {
14
+ $this->app->register(Nanvaie\DatabaseRepository\DatabaseRepositoryServiceProvider::class);
15
+ }
16
+ // snip
13
17
```
14
18
15
19
### Setup for Lumen
16
- Navigate to ` app.php ` in ` bootstrap ` folder and add following line after config registrations:
20
+ Navigate to ` app.php ` in ` bootstrap ` folder and add following line after service providers registrations:
17
21
``` php
18
- $app->register(Nanvaie\DatabaseRepository\DatabaseRepositoryServiceProvider::class)
22
+ // snip
23
+ if ($app->environment('local', 'testing')) {
24
+ $app->register(Nanvaie\DatabaseRepository\DatabaseRepositoryServiceProvider::class);
25
+ }
26
+ // snip
19
27
```
20
28
Copy [ repository.php] ( config/repository.php ) to project config folder located at project root.
21
29
@@ -24,16 +32,22 @@ Note: Make sure to run `composer dump-autoload` after these changes.
24
32
## Usage
25
33
List of artisan commands:
26
34
27
- | Command | Inputs | Options | Description |
28
- | -------------------------------------| -------------| ------------| -----------------------------------|
29
- | ` command:make-entity ` | table_name | -f, -d, -k | Create new Entity |
30
- | ` command:make-factory ` | table_name | -f, -d | Create new Factory |
31
- | ` command:make-resource ` | table_name | -f, -d, -k | Create new Resource |
32
- | ` command:make-interface-repository ` | table_name | -f, -d, -k | Create new Repository Interface |
33
- | ` command:make-repository ` | table_name | -f, -d | Create new Base Repository |
34
- | ` command:make-mysql-repository ` | table_name | -f, -d, -k | Create new MySql Repository class |
35
- | ` command:make-redis-repository ` | table_name | -f, -d, -k | Create new Redis Repository class |
36
- | ` command:make-all-repository ` | table_names | -f, -d, -k | Run all of the above commands |
35
+ | Command | Inputs | Options | Description |
36
+ | -------------------------------------| -------------| ----------------| -----------------------------------|
37
+ | ` command:make-entity ` | table_name | -f, -d, -k, -g | Create new Entity |
38
+ | ` command:make-factory ` | table_name | -f, -d, -g | Create new Factory |
39
+ | ` command:make-resource ` | table_name | -f, -d, -k, -g | Create new Resource |
40
+ | ` command:make-interface-repository ` | table_name | -f, -d, -k, -g | Create new Repository Interface |
41
+ | ` command:make-repository ` | table_name | -f, -d, -g | Create new Base Repository |
42
+ | ` command:make-mysql-repository ` | table_name | -f, -d, -k, -g | Create new MySql Repository class |
43
+ | ` command:make-redis-repository ` | table_name | -f, -d, -k, -g | Create new Redis Repository class |
44
+ | ` command:make-all-repository ` | table_names | -f, -d, -k, -g | Run all of the above commands |
45
+
46
+ ### Options Explanation
47
+ - ` -f|--force ` : Force commands to override existing files.
48
+ - ` -d|--delete ` : Delete already created files.
49
+ - ` -k|--foreign-keys ` : Try to detect foreign keys of table.
50
+ - ` -g|--add-to-git ` : Add created files to git repository.
37
51
38
52
Example 1. Create new Entity for a table named 'users'.
39
53
``` bash
@@ -42,5 +56,5 @@ php artisan command:make-entity users
42
56
43
57
Example 2. Create all necessary classes for two tables named 'users' and 'customers' with enabled foreign key option.
44
58
``` bash
45
- php artisan command:make-all-repository users, customers
59
+ php artisan command:make-all-repository users customers
46
60
```
0 commit comments