1
1
# Repository and Service Command
2
2
3
3
## Instructions
4
+
4
5
Download the repository and extract it.
5
6
6
7
## Installation
7
- ###Step 1:
8
+
9
+ ** Step 1:**
10
+
8
11
Copy ``` app/Console/Commands ``` directory to your project ``` app/Console/ ``` directory.
9
12
``` $xslt
10
13
|-- app/Console/Commands
11
14
|-- Repository.php (core file)
12
15
|-- Service.php (core file)
13
16
```
14
17
15
- ###Step 2:
18
+ ** Step 2:**
19
+
16
20
Copy ``` config/repository.php ``` file to your project ``` config/ ``` directory.
17
21
18
22
``` $xslt
19
23
|-- config
20
24
|-- repository.php (core confid file)
21
25
```
22
26
23
- ###Step 3:
27
+ ** Step 3:**
28
+
24
29
Add following commands to your ``` app/Console/Kernel.php ``` file.
25
30
``` $xslt
26
31
protected $commands = [
27
32
Commands\Repository::class,
28
33
Commands\Service::class,
29
34
];
30
35
```
31
- ###Step 4:
36
+ ** Step 4:**
37
+
32
38
Edit the config file. Remember All the directories are under ` app ` directory.
33
39
``` $xslt
34
40
'repository_directory' => 'Repositories', ## app/Repositories
35
41
'model_directory' => 'Models', #app/Models
36
42
'service_directory' => 'Services', #app/Models
37
43
```
38
- ###Core File Structure:
44
+
45
+ > Core File Structure:
46
+
39
47
```
40
48
|-- config/
41
49
|-- repository.php
@@ -46,26 +54,35 @@ Edit the config file. Remember All the directories are under `app` directory.
46
54
```
47
55
48
56
## Usage
49
- ###Make Repository:
57
+
58
+ ** Make Repository:**
59
+
50
60
The following command makes a repository class ``` TestRepositoryName ``` using model
51
61
``` TestModelName ``` .
62
+
52
63
``` bash
53
64
php artisan make:repository TestRepositoryName TestModelName
54
65
```
55
- ###Make Repository with Service:
66
+
67
+ ** Make Repository with Service:**
68
+
56
69
The following command makes a repository class ``` TestRepositoryName ``` using model
57
70
``` TestModelName ``` and a service ``` TestServiceName ``` .
71
+
58
72
``` bash
59
73
php artisan make:repository TestRepositoryName TestModelName --service=TestServiceName
60
74
```
75
+
61
76
or
77
+
62
78
``` bash
63
79
php artisan make:repository TestRepositoryName TestModelName --s=TestServiceName
64
80
```
65
81
66
82
Service flag ``` --service ``` or ``` --s ``` is optional.
67
83
68
- ###Make Service:
84
+ ** Make Service:**
85
+
69
86
The following command makes a service class ``` TestServiceName ``` using repository
70
87
``` TestRepositoryName ``` .
71
88
@@ -75,14 +92,21 @@ php artisan make:service TestServiceName TestRepositoryName
75
92
76
93
77
94
## Contributing
95
+
78
96
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
79
97
80
98
Please make sure to update tests as appropriate.
99
+
81
100
##Inspired By:
82
- ### [ Mohammad Imran Hossain] ( https://github.com/imranctg16 ) .
83
101
84
- Very much grateful to @imranctg16 .
102
+ ***
103
+ [ Mohammad Imran Hossain] ( https://github.com/imranctg16 ) .
104
+ ***
105
+
106
+ Very much grateful to @imranctg16 .
107
+
85
108
## License
109
+
86
110
[ MIT License] ( https://choosealicense.com/licenses/mit/ )
87
111
88
112
Copyright (c) 2019 [ Towfiqul Islam] ( https://github.com/laziestcoder/ )
0 commit comments