Skip to content

Commit 03eea1b

Browse files
committed
Update Readme.md
1 parent 173c99d commit 03eea1b

File tree

1 file changed

+29
-15
lines changed

1 file changed

+29
-15
lines changed

Readme.md

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,23 @@ composer require nanvaie/database-repository --dev
77
```
88

99
### 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:
1111
```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
1317
```
1418

1519
### 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:
1721
```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
1927
```
2028
Copy [repository.php](config/repository.php) to project config folder located at project root.
2129

@@ -24,16 +32,22 @@ Note: Make sure to run `composer dump-autoload` after these changes.
2432
## Usage
2533
List of artisan commands:
2634

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.
3751

3852
Example 1. Create new Entity for a table named 'users'.
3953
```bash
@@ -42,5 +56,5 @@ php artisan command:make-entity users
4256

4357
Example 2. Create all necessary classes for two tables named 'users' and 'customers' with enabled foreign key option.
4458
```bash
45-
php artisan command:make-all-repository users,customers
59+
php artisan command:make-all-repository users customers
4660
```

0 commit comments

Comments
 (0)