@@ -5,44 +5,44 @@ |
||
5 | 5 | */ |
6 | 6 | class AclPermissionObserver { |
7 | 7 | |
8 | - public function saving($model) |
|
9 | - { |
|
10 | - // |
|
11 | - } |
|
12 | - |
|
13 | - public function saved($model) |
|
14 | - { |
|
15 | - // |
|
16 | - } |
|
17 | - |
|
18 | - public function creating($model) |
|
19 | - { |
|
20 | - // |
|
21 | - } |
|
22 | - |
|
23 | - public function created($model) |
|
24 | - { |
|
25 | - // |
|
26 | - } |
|
27 | - |
|
28 | - public function updating($model) |
|
29 | - { |
|
30 | - // |
|
31 | - } |
|
32 | - |
|
33 | - public function updated($model) |
|
34 | - { |
|
35 | - // |
|
36 | - } |
|
37 | - |
|
38 | - public function deleting($model) |
|
39 | - { |
|
40 | - // |
|
41 | - } |
|
42 | - |
|
43 | - public function deleted($model) |
|
44 | - { |
|
45 | - // |
|
46 | - } |
|
8 | + public function saving($model) |
|
9 | + { |
|
10 | + // |
|
11 | + } |
|
12 | + |
|
13 | + public function saved($model) |
|
14 | + { |
|
15 | + // |
|
16 | + } |
|
17 | + |
|
18 | + public function creating($model) |
|
19 | + { |
|
20 | + // |
|
21 | + } |
|
22 | + |
|
23 | + public function created($model) |
|
24 | + { |
|
25 | + // |
|
26 | + } |
|
27 | + |
|
28 | + public function updating($model) |
|
29 | + { |
|
30 | + // |
|
31 | + } |
|
32 | + |
|
33 | + public function updated($model) |
|
34 | + { |
|
35 | + // |
|
36 | + } |
|
37 | + |
|
38 | + public function deleting($model) |
|
39 | + { |
|
40 | + // |
|
41 | + } |
|
42 | + |
|
43 | + public function deleted($model) |
|
44 | + { |
|
45 | + // |
|
46 | + } |
|
47 | 47 | |
48 | 48 | } |
49 | 49 | \ No newline at end of file |
@@ -13,233 +13,233 @@ discard block |
||
13 | 13 | public function up() |
14 | 14 | { |
15 | 15 | /** |
16 | - * Insert the permissions related to this module. |
|
17 | - */ |
|
18 | - DB::table('permissions')->insert( |
|
19 | - [ |
|
20 | - /** |
|
21 | - * Users model permissions. |
|
22 | - */ |
|
23 | - [ |
|
24 | - 'name' => 'save', |
|
25 | - 'model' => 'users', |
|
26 | - 'created_at' => \DB::raw('NOW()'), |
|
27 | - 'updated_at' => \DB::raw('NOW()') |
|
28 | - ], |
|
29 | - [ |
|
30 | - 'name' => 'delete', |
|
31 | - 'model' => 'users', |
|
32 | - 'created_at' => \DB::raw('NOW()'), |
|
33 | - 'updated_at' => \DB::raw('NOW()') |
|
34 | - ], |
|
35 | - [ |
|
36 | - 'name' => 'find', |
|
37 | - 'model' => 'users', |
|
38 | - 'created_at' => \DB::raw('NOW()'), |
|
39 | - 'updated_at' => \DB::raw('NOW()') |
|
40 | - ], |
|
41 | - [ |
|
42 | - 'name' => 'list', |
|
43 | - 'model' => 'users', |
|
44 | - 'created_at' => \DB::raw('NOW()'), |
|
45 | - 'updated_at' => \DB::raw('NOW()') |
|
46 | - ], |
|
47 | - [ |
|
48 | - 'name' => 'search', |
|
49 | - 'model' => 'users', |
|
50 | - 'created_at' => \DB::raw('NOW()'), |
|
51 | - 'updated_at' => \DB::raw('NOW()') |
|
52 | - ], |
|
53 | - [ |
|
54 | - 'name' => 'findby', |
|
55 | - 'model' => 'users', |
|
56 | - 'created_at' => \DB::raw('NOW()'), |
|
57 | - 'updated_at' => \DB::raw('NOW()') |
|
58 | - ], |
|
59 | - [ |
|
60 | - 'name' => 'first', |
|
61 | - 'model' => 'users', |
|
62 | - 'created_at' => \DB::raw('NOW()'), |
|
63 | - 'updated_at' => \DB::raw('NOW()') |
|
64 | - ], |
|
65 | - [ |
|
66 | - 'name' => 'paginate', |
|
67 | - 'model' => 'users', |
|
68 | - 'created_at' => \DB::raw('NOW()'), |
|
69 | - 'updated_at' => \DB::raw('NOW()') |
|
70 | - ], |
|
71 | - [ |
|
72 | - 'name' => 'paginateby', |
|
73 | - 'model' => 'users', |
|
74 | - 'created_at' => \DB::raw('NOW()'), |
|
75 | - 'updated_at' => \DB::raw('NOW()') |
|
76 | - ], |
|
77 | - [ |
|
78 | - 'name' => 'assigngroups', |
|
79 | - 'model' => 'users', |
|
80 | - 'created_at' => \DB::raw('NOW()'), |
|
81 | - 'updated_at' => \DB::raw('NOW()') |
|
82 | - ], |
|
83 | - [ |
|
84 | - 'name' => 'block', |
|
85 | - 'model' => 'users', |
|
86 | - 'created_at' => \DB::raw('NOW()'), |
|
87 | - 'updated_at' => \DB::raw('NOW()') |
|
88 | - ], |
|
89 | - [ |
|
90 | - 'name' => 'unblock', |
|
91 | - 'model' => 'users', |
|
92 | - 'created_at' => \DB::raw('NOW()'), |
|
93 | - 'updated_at' => \DB::raw('NOW()') |
|
94 | - ], |
|
95 | - [ |
|
96 | - 'name' => 'group', |
|
97 | - 'model' => 'users', |
|
98 | - 'created_at' => \DB::raw('NOW()'), |
|
99 | - 'updated_at' => \DB::raw('NOW()') |
|
100 | - ], |
|
101 | - [ |
|
102 | - 'name' => 'deleted', |
|
103 | - 'model' => 'users', |
|
104 | - 'created_at' => \DB::raw('NOW()'), |
|
105 | - 'updated_at' => \DB::raw('NOW()') |
|
106 | - ], |
|
107 | - [ |
|
108 | - 'name' => 'restore', |
|
109 | - 'model' => 'users', |
|
110 | - 'created_at' => \DB::raw('NOW()'), |
|
111 | - 'updated_at' => \DB::raw('NOW()') |
|
112 | - ], |
|
16 | + * Insert the permissions related to this module. |
|
17 | + */ |
|
18 | + DB::table('permissions')->insert( |
|
19 | + [ |
|
20 | + /** |
|
21 | + * Users model permissions. |
|
22 | + */ |
|
23 | + [ |
|
24 | + 'name' => 'save', |
|
25 | + 'model' => 'users', |
|
26 | + 'created_at' => \DB::raw('NOW()'), |
|
27 | + 'updated_at' => \DB::raw('NOW()') |
|
28 | + ], |
|
29 | + [ |
|
30 | + 'name' => 'delete', |
|
31 | + 'model' => 'users', |
|
32 | + 'created_at' => \DB::raw('NOW()'), |
|
33 | + 'updated_at' => \DB::raw('NOW()') |
|
34 | + ], |
|
35 | + [ |
|
36 | + 'name' => 'find', |
|
37 | + 'model' => 'users', |
|
38 | + 'created_at' => \DB::raw('NOW()'), |
|
39 | + 'updated_at' => \DB::raw('NOW()') |
|
40 | + ], |
|
41 | + [ |
|
42 | + 'name' => 'list', |
|
43 | + 'model' => 'users', |
|
44 | + 'created_at' => \DB::raw('NOW()'), |
|
45 | + 'updated_at' => \DB::raw('NOW()') |
|
46 | + ], |
|
47 | + [ |
|
48 | + 'name' => 'search', |
|
49 | + 'model' => 'users', |
|
50 | + 'created_at' => \DB::raw('NOW()'), |
|
51 | + 'updated_at' => \DB::raw('NOW()') |
|
52 | + ], |
|
53 | + [ |
|
54 | + 'name' => 'findby', |
|
55 | + 'model' => 'users', |
|
56 | + 'created_at' => \DB::raw('NOW()'), |
|
57 | + 'updated_at' => \DB::raw('NOW()') |
|
58 | + ], |
|
59 | + [ |
|
60 | + 'name' => 'first', |
|
61 | + 'model' => 'users', |
|
62 | + 'created_at' => \DB::raw('NOW()'), |
|
63 | + 'updated_at' => \DB::raw('NOW()') |
|
64 | + ], |
|
65 | + [ |
|
66 | + 'name' => 'paginate', |
|
67 | + 'model' => 'users', |
|
68 | + 'created_at' => \DB::raw('NOW()'), |
|
69 | + 'updated_at' => \DB::raw('NOW()') |
|
70 | + ], |
|
71 | + [ |
|
72 | + 'name' => 'paginateby', |
|
73 | + 'model' => 'users', |
|
74 | + 'created_at' => \DB::raw('NOW()'), |
|
75 | + 'updated_at' => \DB::raw('NOW()') |
|
76 | + ], |
|
77 | + [ |
|
78 | + 'name' => 'assigngroups', |
|
79 | + 'model' => 'users', |
|
80 | + 'created_at' => \DB::raw('NOW()'), |
|
81 | + 'updated_at' => \DB::raw('NOW()') |
|
82 | + ], |
|
83 | + [ |
|
84 | + 'name' => 'block', |
|
85 | + 'model' => 'users', |
|
86 | + 'created_at' => \DB::raw('NOW()'), |
|
87 | + 'updated_at' => \DB::raw('NOW()') |
|
88 | + ], |
|
89 | + [ |
|
90 | + 'name' => 'unblock', |
|
91 | + 'model' => 'users', |
|
92 | + 'created_at' => \DB::raw('NOW()'), |
|
93 | + 'updated_at' => \DB::raw('NOW()') |
|
94 | + ], |
|
95 | + [ |
|
96 | + 'name' => 'group', |
|
97 | + 'model' => 'users', |
|
98 | + 'created_at' => \DB::raw('NOW()'), |
|
99 | + 'updated_at' => \DB::raw('NOW()') |
|
100 | + ], |
|
101 | + [ |
|
102 | + 'name' => 'deleted', |
|
103 | + 'model' => 'users', |
|
104 | + 'created_at' => \DB::raw('NOW()'), |
|
105 | + 'updated_at' => \DB::raw('NOW()') |
|
106 | + ], |
|
107 | + [ |
|
108 | + 'name' => 'restore', |
|
109 | + 'model' => 'users', |
|
110 | + 'created_at' => \DB::raw('NOW()'), |
|
111 | + 'updated_at' => \DB::raw('NOW()') |
|
112 | + ], |
|
113 | 113 | |
114 | - /** |
|
115 | - * Permissions model permissions. |
|
116 | - */ |
|
117 | - [ |
|
118 | - 'name' => 'find', |
|
119 | - 'model' => 'permissions', |
|
120 | - 'created_at' => \DB::raw('NOW()'), |
|
121 | - 'updated_at' => \DB::raw('NOW()') |
|
122 | - ], |
|
123 | - [ |
|
124 | - 'name' => 'search', |
|
125 | - 'model' => 'permissions', |
|
126 | - 'created_at' => \DB::raw('NOW()'), |
|
127 | - 'updated_at' => \DB::raw('NOW()') |
|
128 | - ], |
|
129 | - [ |
|
130 | - 'name' => 'list', |
|
131 | - 'model' => 'permissions', |
|
132 | - 'created_at' => \DB::raw('NOW()'), |
|
133 | - 'updated_at' => \DB::raw('NOW()') |
|
134 | - ], |
|
135 | - [ |
|
136 | - 'name' => 'findby', |
|
137 | - 'model' => 'permissions', |
|
138 | - 'created_at' => \DB::raw('NOW()'), |
|
139 | - 'updated_at' => \DB::raw('NOW()') |
|
140 | - ], |
|
141 | - [ |
|
142 | - 'name' => 'first', |
|
143 | - 'model' => 'permissions', |
|
144 | - 'created_at' => \DB::raw('NOW()'), |
|
145 | - 'updated_at' => \DB::raw('NOW()') |
|
146 | - ], |
|
147 | - [ |
|
148 | - 'name' => 'paginate', |
|
149 | - 'model' => 'permissions', |
|
150 | - 'created_at' => \DB::raw('NOW()'), |
|
151 | - 'updated_at' => \DB::raw('NOW()') |
|
152 | - ], |
|
153 | - [ |
|
154 | - 'name' => 'paginateby', |
|
155 | - 'model' => 'permissions', |
|
156 | - 'created_at' => \DB::raw('NOW()'), |
|
157 | - 'updated_at' => \DB::raw('NOW()') |
|
158 | - ], |
|
114 | + /** |
|
115 | + * Permissions model permissions. |
|
116 | + */ |
|
117 | + [ |
|
118 | + 'name' => 'find', |
|
119 | + 'model' => 'permissions', |
|
120 | + 'created_at' => \DB::raw('NOW()'), |
|
121 | + 'updated_at' => \DB::raw('NOW()') |
|
122 | + ], |
|
123 | + [ |
|
124 | + 'name' => 'search', |
|
125 | + 'model' => 'permissions', |
|
126 | + 'created_at' => \DB::raw('NOW()'), |
|
127 | + 'updated_at' => \DB::raw('NOW()') |
|
128 | + ], |
|
129 | + [ |
|
130 | + 'name' => 'list', |
|
131 | + 'model' => 'permissions', |
|
132 | + 'created_at' => \DB::raw('NOW()'), |
|
133 | + 'updated_at' => \DB::raw('NOW()') |
|
134 | + ], |
|
135 | + [ |
|
136 | + 'name' => 'findby', |
|
137 | + 'model' => 'permissions', |
|
138 | + 'created_at' => \DB::raw('NOW()'), |
|
139 | + 'updated_at' => \DB::raw('NOW()') |
|
140 | + ], |
|
141 | + [ |
|
142 | + 'name' => 'first', |
|
143 | + 'model' => 'permissions', |
|
144 | + 'created_at' => \DB::raw('NOW()'), |
|
145 | + 'updated_at' => \DB::raw('NOW()') |
|
146 | + ], |
|
147 | + [ |
|
148 | + 'name' => 'paginate', |
|
149 | + 'model' => 'permissions', |
|
150 | + 'created_at' => \DB::raw('NOW()'), |
|
151 | + 'updated_at' => \DB::raw('NOW()') |
|
152 | + ], |
|
153 | + [ |
|
154 | + 'name' => 'paginateby', |
|
155 | + 'model' => 'permissions', |
|
156 | + 'created_at' => \DB::raw('NOW()'), |
|
157 | + 'updated_at' => \DB::raw('NOW()') |
|
158 | + ], |
|
159 | 159 | |
160 | - /** |
|
161 | - * Groups model permissions. |
|
162 | - */ |
|
163 | - [ |
|
164 | - 'name' => 'save', |
|
165 | - 'model' => 'groups', |
|
166 | - 'created_at' => \DB::raw('NOW()'), |
|
167 | - 'updated_at' => \DB::raw('NOW()') |
|
168 | - ], |
|
169 | - [ |
|
170 | - 'name' => 'delete', |
|
171 | - 'model' => 'groups', |
|
172 | - 'created_at' => \DB::raw('NOW()'), |
|
173 | - 'updated_at' => \DB::raw('NOW()') |
|
174 | - ], |
|
175 | - [ |
|
176 | - 'name' => 'find', |
|
177 | - 'model' => 'groups', |
|
178 | - 'created_at' => \DB::raw('NOW()'), |
|
179 | - 'updated_at' => \DB::raw('NOW()') |
|
180 | - ], |
|
181 | - [ |
|
182 | - 'name' => 'search', |
|
183 | - 'model' => 'groups', |
|
184 | - 'created_at' => \DB::raw('NOW()'), |
|
185 | - 'updated_at' => \DB::raw('NOW()') |
|
186 | - ], |
|
187 | - [ |
|
188 | - 'name' => 'list', |
|
189 | - 'model' => 'groups', |
|
190 | - 'created_at' => \DB::raw('NOW()'), |
|
191 | - 'updated_at' => \DB::raw('NOW()') |
|
192 | - ], |
|
193 | - [ |
|
194 | - 'name' => 'findby', |
|
195 | - 'model' => 'groups', |
|
196 | - 'created_at' => \DB::raw('NOW()'), |
|
197 | - 'updated_at' => \DB::raw('NOW()') |
|
198 | - ], |
|
199 | - [ |
|
200 | - 'name' => 'first', |
|
201 | - 'model' => 'groups', |
|
202 | - 'created_at' => \DB::raw('NOW()'), |
|
203 | - 'updated_at' => \DB::raw('NOW()') |
|
204 | - ], |
|
205 | - [ |
|
206 | - 'name' => 'paginate', |
|
207 | - 'model' => 'groups', |
|
208 | - 'created_at' => \DB::raw('NOW()'), |
|
209 | - 'updated_at' => \DB::raw('NOW()') |
|
210 | - ], |
|
211 | - [ |
|
212 | - 'name' => 'paginateby', |
|
213 | - 'model' => 'groups', |
|
214 | - 'created_at' => \DB::raw('NOW()'), |
|
215 | - 'updated_at' => \DB::raw('NOW()') |
|
216 | - ], |
|
217 | - [ |
|
218 | - 'name' => 'assignpermissions', |
|
219 | - 'model' => 'groups', |
|
220 | - 'created_at' => \DB::raw('NOW()'), |
|
221 | - 'updated_at' => \DB::raw('NOW()') |
|
222 | - ], |
|
223 | - [ |
|
224 | - 'name' => 'users', |
|
225 | - 'model' => 'groups', |
|
226 | - 'created_at' => \DB::raw('NOW()'), |
|
227 | - 'updated_at' => \DB::raw('NOW()') |
|
228 | - ], |
|
229 | - [ |
|
230 | - 'name' => 'deleted', |
|
231 | - 'model' => 'groups', |
|
232 | - 'created_at' => \DB::raw('NOW()'), |
|
233 | - 'updated_at' => \DB::raw('NOW()') |
|
234 | - ], |
|
235 | - [ |
|
236 | - 'name' => 'restore', |
|
237 | - 'model' => 'groups', |
|
238 | - 'created_at' => \DB::raw('NOW()'), |
|
239 | - 'updated_at' => \DB::raw('NOW()') |
|
240 | - ], |
|
241 | - ] |
|
242 | - ); |
|
160 | + /** |
|
161 | + * Groups model permissions. |
|
162 | + */ |
|
163 | + [ |
|
164 | + 'name' => 'save', |
|
165 | + 'model' => 'groups', |
|
166 | + 'created_at' => \DB::raw('NOW()'), |
|
167 | + 'updated_at' => \DB::raw('NOW()') |
|
168 | + ], |
|
169 | + [ |
|
170 | + 'name' => 'delete', |
|
171 | + 'model' => 'groups', |
|
172 | + 'created_at' => \DB::raw('NOW()'), |
|
173 | + 'updated_at' => \DB::raw('NOW()') |
|
174 | + ], |
|
175 | + [ |
|
176 | + 'name' => 'find', |
|
177 | + 'model' => 'groups', |
|
178 | + 'created_at' => \DB::raw('NOW()'), |
|
179 | + 'updated_at' => \DB::raw('NOW()') |
|
180 | + ], |
|
181 | + [ |
|
182 | + 'name' => 'search', |
|
183 | + 'model' => 'groups', |
|
184 | + 'created_at' => \DB::raw('NOW()'), |
|
185 | + 'updated_at' => \DB::raw('NOW()') |
|
186 | + ], |
|
187 | + [ |
|
188 | + 'name' => 'list', |
|
189 | + 'model' => 'groups', |
|
190 | + 'created_at' => \DB::raw('NOW()'), |
|
191 | + 'updated_at' => \DB::raw('NOW()') |
|
192 | + ], |
|
193 | + [ |
|
194 | + 'name' => 'findby', |
|
195 | + 'model' => 'groups', |
|
196 | + 'created_at' => \DB::raw('NOW()'), |
|
197 | + 'updated_at' => \DB::raw('NOW()') |
|
198 | + ], |
|
199 | + [ |
|
200 | + 'name' => 'first', |
|
201 | + 'model' => 'groups', |
|
202 | + 'created_at' => \DB::raw('NOW()'), |
|
203 | + 'updated_at' => \DB::raw('NOW()') |
|
204 | + ], |
|
205 | + [ |
|
206 | + 'name' => 'paginate', |
|
207 | + 'model' => 'groups', |
|
208 | + 'created_at' => \DB::raw('NOW()'), |
|
209 | + 'updated_at' => \DB::raw('NOW()') |
|
210 | + ], |
|
211 | + [ |
|
212 | + 'name' => 'paginateby', |
|
213 | + 'model' => 'groups', |
|
214 | + 'created_at' => \DB::raw('NOW()'), |
|
215 | + 'updated_at' => \DB::raw('NOW()') |
|
216 | + ], |
|
217 | + [ |
|
218 | + 'name' => 'assignpermissions', |
|
219 | + 'model' => 'groups', |
|
220 | + 'created_at' => \DB::raw('NOW()'), |
|
221 | + 'updated_at' => \DB::raw('NOW()') |
|
222 | + ], |
|
223 | + [ |
|
224 | + 'name' => 'users', |
|
225 | + 'model' => 'groups', |
|
226 | + 'created_at' => \DB::raw('NOW()'), |
|
227 | + 'updated_at' => \DB::raw('NOW()') |
|
228 | + ], |
|
229 | + [ |
|
230 | + 'name' => 'deleted', |
|
231 | + 'model' => 'groups', |
|
232 | + 'created_at' => \DB::raw('NOW()'), |
|
233 | + 'updated_at' => \DB::raw('NOW()') |
|
234 | + ], |
|
235 | + [ |
|
236 | + 'name' => 'restore', |
|
237 | + 'model' => 'groups', |
|
238 | + 'created_at' => \DB::raw('NOW()'), |
|
239 | + 'updated_at' => \DB::raw('NOW()') |
|
240 | + ], |
|
241 | + ] |
|
242 | + ); |
|
243 | 243 | |
244 | 244 | /** |
245 | 245 | * Create Default groups. |
@@ -256,29 +256,29 @@ discard block |
||
256 | 256 | * Create Default users. |
257 | 257 | */ |
258 | 258 | $adminUserId = DB::table('users')->insertGetId( |
259 | - [ |
|
259 | + [ |
|
260 | 260 | 'email' => '[email protected]', |
261 | 261 | 'password' => bcrypt('123456'), |
262 | 262 | 'created_at' => \DB::raw('NOW()'), |
263 | 263 | 'updated_at' => \DB::raw('NOW()') |
264 | 264 | ] |
265 | - ); |
|
265 | + ); |
|
266 | 266 | |
267 | 267 | /** |
268 | 268 | * Assign users to groups. |
269 | 269 | */ |
270 | 270 | DB::table('users_groups')->insert( |
271 | - [ |
|
272 | - [ |
|
271 | + [ |
|
272 | + [ |
|
273 | 273 | 'user_id' => $adminUserId, |
274 | 274 | 'group_id' => $adminGroupId, |
275 | 275 | 'created_at' => \DB::raw('NOW()'), |
276 | 276 | 'updated_at' => \DB::raw('NOW()') |
277 | - ] |
|
278 | - ] |
|
279 | - ); |
|
277 | + ] |
|
278 | + ] |
|
279 | + ); |
|
280 | 280 | |
281 | - /** |
|
281 | + /** |
|
282 | 282 | * Assign the permissions to the admin group. |
283 | 283 | */ |
284 | 284 | $permissionIds = DB::table('permissions')->whereIn('model', ['users', 'permissions', 'groups'])->select('id')->pluck('id'); |
@@ -170,8 +170,7 @@ |
||
170 | 170 | if ($request->has('id')) |
171 | 171 | { |
172 | 172 | $rule = str_replace('{id}', $request->get('id'), $rule); |
173 | - } |
|
174 | - else |
|
173 | + } else |
|
175 | 174 | { |
176 | 175 | $rule = str_replace(',{id}', '', $rule); |
177 | 176 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * to preform actions like (add, edit ... etc). |
13 | 13 | * @var string |
14 | 14 | */ |
15 | - protected $model = 'users'; |
|
15 | + protected $model = 'users'; |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * List of all route actions that the base api controller |
@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | * will skip login check for them. |
27 | 27 | * @var array |
28 | 28 | */ |
29 | - protected $skipLoginCheck = ['login', 'loginSocial', 'register', 'sendreset', 'resetpassword', 'refreshtoken']; |
|
29 | + protected $skipLoginCheck = ['login', 'loginSocial', 'register', 'sendreset', 'resetpassword', 'refreshtoken']; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * The validations rules used by the base api controller |
33 | 33 | * to check before add. |
34 | 34 | * @var array |
35 | 35 | */ |
36 | - protected $validationRules = [ |
|
36 | + protected $validationRules = [ |
|
37 | 37 | 'name' => 'nullable|string|unique:users,name,{id},id,name,NOT_NULL', |
38 | 38 | 'email' => 'required|email|unique:users,email,{id},id,email,NOT_NULL', |
39 | 39 | 'password' => 'nullable|min:6' |
@@ -7,250 +7,250 @@ |
||
7 | 7 | |
8 | 8 | class UsersController extends BaseApiController |
9 | 9 | { |
10 | - /** |
|
11 | - * The name of the model that is used by the base api controller |
|
12 | - * to preform actions like (add, edit ... etc). |
|
13 | - * @var string |
|
14 | - */ |
|
15 | - protected $model = 'users'; |
|
10 | + /** |
|
11 | + * The name of the model that is used by the base api controller |
|
12 | + * to preform actions like (add, edit ... etc). |
|
13 | + * @var string |
|
14 | + */ |
|
15 | + protected $model = 'users'; |
|
16 | 16 | |
17 | - /** |
|
18 | - * List of all route actions that the base api controller |
|
19 | - * will skip permissions check for them. |
|
20 | - * @var array |
|
21 | - */ |
|
22 | - protected $skipPermissionCheck = ['account', 'logout', 'sendreset', 'changePassword']; |
|
17 | + /** |
|
18 | + * List of all route actions that the base api controller |
|
19 | + * will skip permissions check for them. |
|
20 | + * @var array |
|
21 | + */ |
|
22 | + protected $skipPermissionCheck = ['account', 'logout', 'sendreset', 'changePassword']; |
|
23 | 23 | |
24 | - /** |
|
25 | - * List of all route actions that the base api controller |
|
26 | - * will skip login check for them. |
|
27 | - * @var array |
|
28 | - */ |
|
29 | - protected $skipLoginCheck = ['login', 'loginSocial', 'register', 'sendreset', 'resetpassword', 'refreshtoken']; |
|
24 | + /** |
|
25 | + * List of all route actions that the base api controller |
|
26 | + * will skip login check for them. |
|
27 | + * @var array |
|
28 | + */ |
|
29 | + protected $skipLoginCheck = ['login', 'loginSocial', 'register', 'sendreset', 'resetpassword', 'refreshtoken']; |
|
30 | 30 | |
31 | - /** |
|
32 | - * The validations rules used by the base api controller |
|
33 | - * to check before add. |
|
34 | - * @var array |
|
35 | - */ |
|
36 | - protected $validationRules = [ |
|
37 | - 'name' => 'nullable|string|unique:users,name,{id},id,name,NOT_NULL', |
|
38 | - 'email' => 'required|email|unique:users,email,{id},id,email,NOT_NULL', |
|
39 | - 'password' => 'nullable|min:6' |
|
40 | - ]; |
|
31 | + /** |
|
32 | + * The validations rules used by the base api controller |
|
33 | + * to check before add. |
|
34 | + * @var array |
|
35 | + */ |
|
36 | + protected $validationRules = [ |
|
37 | + 'name' => 'nullable|string|unique:users,name,{id},id,name,NOT_NULL', |
|
38 | + 'email' => 'required|email|unique:users,email,{id},id,email,NOT_NULL', |
|
39 | + 'password' => 'nullable|min:6' |
|
40 | + ]; |
|
41 | 41 | |
42 | - /** |
|
43 | - * Return the logged in user account. |
|
44 | - * |
|
45 | - * @return \Illuminate\Http\Response |
|
46 | - */ |
|
47 | - public function account() |
|
48 | - { |
|
49 | - return \Response::json(\Core::users()->account($this->relations), 200); |
|
50 | - } |
|
42 | + /** |
|
43 | + * Return the logged in user account. |
|
44 | + * |
|
45 | + * @return \Illuminate\Http\Response |
|
46 | + */ |
|
47 | + public function account() |
|
48 | + { |
|
49 | + return \Response::json(\Core::users()->account($this->relations), 200); |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * Block the user. |
|
54 | - * |
|
55 | - * @param integer $id |
|
56 | - * @return \Illuminate\Http\Response |
|
57 | - */ |
|
58 | - public function block($id) |
|
59 | - { |
|
60 | - return \Response::json(\Core::users()->block($id), 200); |
|
61 | - } |
|
52 | + /** |
|
53 | + * Block the user. |
|
54 | + * |
|
55 | + * @param integer $id |
|
56 | + * @return \Illuminate\Http\Response |
|
57 | + */ |
|
58 | + public function block($id) |
|
59 | + { |
|
60 | + return \Response::json(\Core::users()->block($id), 200); |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * Unblock the user. |
|
65 | - * |
|
66 | - * @param integer $id |
|
67 | - * @return \Illuminate\Http\Response |
|
68 | - */ |
|
69 | - public function unblock($id) |
|
70 | - { |
|
71 | - return \Response::json(\Core::users()->unblock($id), 200); |
|
72 | - } |
|
63 | + /** |
|
64 | + * Unblock the user. |
|
65 | + * |
|
66 | + * @param integer $id |
|
67 | + * @return \Illuminate\Http\Response |
|
68 | + */ |
|
69 | + public function unblock($id) |
|
70 | + { |
|
71 | + return \Response::json(\Core::users()->unblock($id), 200); |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
75 | - * Logout the user. |
|
76 | - * |
|
77 | - * @return \Illuminate\Http\Response |
|
78 | - */ |
|
79 | - public function logout() |
|
80 | - { |
|
81 | - return \Response::json(\Core::users()->logout(), 200); |
|
82 | - } |
|
74 | + /** |
|
75 | + * Logout the user. |
|
76 | + * |
|
77 | + * @return \Illuminate\Http\Response |
|
78 | + */ |
|
79 | + public function logout() |
|
80 | + { |
|
81 | + return \Response::json(\Core::users()->logout(), 200); |
|
82 | + } |
|
83 | 83 | |
84 | - /** |
|
85 | - * Handle a registration request. |
|
86 | - * |
|
87 | - * @param \Illuminate\Http\Request $request |
|
88 | - * @return \Illuminate\Http\Response |
|
89 | - */ |
|
90 | - public function register(Request $request) |
|
91 | - { |
|
92 | - $this->validate($request, [ |
|
93 | - 'name' => 'nullable|string|unique:users,name,{id},id,name,NOT_NULL', |
|
94 | - 'email' => 'required|email|unique:users,email,{id},id,email,NOT_NULL', |
|
95 | - 'password' => 'required|min:6' |
|
96 | - ]); |
|
84 | + /** |
|
85 | + * Handle a registration request. |
|
86 | + * |
|
87 | + * @param \Illuminate\Http\Request $request |
|
88 | + * @return \Illuminate\Http\Response |
|
89 | + */ |
|
90 | + public function register(Request $request) |
|
91 | + { |
|
92 | + $this->validate($request, [ |
|
93 | + 'name' => 'nullable|string|unique:users,name,{id},id,name,NOT_NULL', |
|
94 | + 'email' => 'required|email|unique:users,email,{id},id,email,NOT_NULL', |
|
95 | + 'password' => 'required|min:6' |
|
96 | + ]); |
|
97 | 97 | |
98 | - return \Response::json(\Core::users()->register($request->only('email', 'password')), 200); |
|
99 | - } |
|
98 | + return \Response::json(\Core::users()->register($request->only('email', 'password')), 200); |
|
99 | + } |
|
100 | 100 | |
101 | - /** |
|
102 | - * Handle a login request of the none admin to the application. |
|
103 | - * |
|
104 | - * @param \Illuminate\Http\Request $request |
|
105 | - * @return \Illuminate\Http\Response |
|
106 | - */ |
|
107 | - public function login(Request $request) |
|
108 | - { |
|
109 | - $this->validate($request, [ |
|
110 | - 'email' => 'required|email', |
|
111 | - 'password' => 'required|min:6', |
|
112 | - 'admin' => 'boolean' |
|
113 | - ]); |
|
101 | + /** |
|
102 | + * Handle a login request of the none admin to the application. |
|
103 | + * |
|
104 | + * @param \Illuminate\Http\Request $request |
|
105 | + * @return \Illuminate\Http\Response |
|
106 | + */ |
|
107 | + public function login(Request $request) |
|
108 | + { |
|
109 | + $this->validate($request, [ |
|
110 | + 'email' => 'required|email', |
|
111 | + 'password' => 'required|min:6', |
|
112 | + 'admin' => 'boolean' |
|
113 | + ]); |
|
114 | 114 | |
115 | - return \Response::json(\Core::users()->login($request->only('email', 'password'), $request->get('admin')), 200); |
|
116 | - } |
|
115 | + return \Response::json(\Core::users()->login($request->only('email', 'password'), $request->get('admin')), 200); |
|
116 | + } |
|
117 | 117 | |
118 | - /** |
|
119 | - * Handle a social login request of the none admin to the application. |
|
120 | - * |
|
121 | - * @param \Illuminate\Http\Request $request |
|
122 | - * @return \Illuminate\Http\Response |
|
123 | - */ |
|
124 | - public function loginSocial(Request $request) |
|
125 | - { |
|
126 | - $this->validate($request, [ |
|
127 | - 'auth_code' => 'required_without:access_token', |
|
128 | - 'access_token' => 'required_without:auth_code', |
|
129 | - 'type' => 'required|in:facebook,google' |
|
130 | - ]); |
|
118 | + /** |
|
119 | + * Handle a social login request of the none admin to the application. |
|
120 | + * |
|
121 | + * @param \Illuminate\Http\Request $request |
|
122 | + * @return \Illuminate\Http\Response |
|
123 | + */ |
|
124 | + public function loginSocial(Request $request) |
|
125 | + { |
|
126 | + $this->validate($request, [ |
|
127 | + 'auth_code' => 'required_without:access_token', |
|
128 | + 'access_token' => 'required_without:auth_code', |
|
129 | + 'type' => 'required|in:facebook,google' |
|
130 | + ]); |
|
131 | 131 | |
132 | - return \Response::json(\Core::users()->loginSocial($request->only('auth_code', 'access_token', 'type')), 200); |
|
133 | - } |
|
132 | + return \Response::json(\Core::users()->loginSocial($request->only('auth_code', 'access_token', 'type')), 200); |
|
133 | + } |
|
134 | 134 | |
135 | - /** |
|
136 | - * Handle an assign groups to user request. |
|
137 | - * |
|
138 | - * @param \Illuminate\Http\Request $request |
|
139 | - * @return \Illuminate\Http\Response |
|
140 | - */ |
|
141 | - public function assigngroups(Request $request) |
|
142 | - { |
|
143 | - $this->validate($request, [ |
|
144 | - 'group_ids' => 'required|exists:groups,id', |
|
145 | - 'user_id' => 'required|exists:users,id' |
|
146 | - ]); |
|
135 | + /** |
|
136 | + * Handle an assign groups to user request. |
|
137 | + * |
|
138 | + * @param \Illuminate\Http\Request $request |
|
139 | + * @return \Illuminate\Http\Response |
|
140 | + */ |
|
141 | + public function assigngroups(Request $request) |
|
142 | + { |
|
143 | + $this->validate($request, [ |
|
144 | + 'group_ids' => 'required|exists:groups,id', |
|
145 | + 'user_id' => 'required|exists:users,id' |
|
146 | + ]); |
|
147 | 147 | |
148 | - return \Response::json(\Core::users()->assignGroups($request->get('user_id'), $request->get('group_ids')), 200); |
|
149 | - } |
|
148 | + return \Response::json(\Core::users()->assignGroups($request->get('user_id'), $request->get('group_ids')), 200); |
|
149 | + } |
|
150 | 150 | |
151 | - /** |
|
152 | - * Send a reset link to the given user. |
|
153 | - * |
|
154 | - * @param \Illuminate\Http\Request $request |
|
155 | - * @return \Illuminate\Http\Response |
|
156 | - */ |
|
157 | - public function sendreset(Request $request) |
|
158 | - { |
|
159 | - $this->validate($request, ['email' => 'required|email', 'url' => 'required|url']); |
|
151 | + /** |
|
152 | + * Send a reset link to the given user. |
|
153 | + * |
|
154 | + * @param \Illuminate\Http\Request $request |
|
155 | + * @return \Illuminate\Http\Response |
|
156 | + */ |
|
157 | + public function sendreset(Request $request) |
|
158 | + { |
|
159 | + $this->validate($request, ['email' => 'required|email', 'url' => 'required|url']); |
|
160 | 160 | |
161 | - return \Response::json(\Core::users()->sendReset($request->only('email'), $request->get('url')), 200); |
|
162 | - } |
|
161 | + return \Response::json(\Core::users()->sendReset($request->only('email'), $request->get('url')), 200); |
|
162 | + } |
|
163 | 163 | |
164 | - /** |
|
165 | - * Reset the given user's password. |
|
166 | - * |
|
167 | - * @param \Illuminate\Http\Request $request |
|
168 | - * @return \Illuminate\Http\Response |
|
169 | - */ |
|
170 | - public function resetpassword(Request $request) |
|
171 | - { |
|
172 | - $this->validate($request, [ |
|
173 | - 'token' => 'required', |
|
174 | - 'email' => 'required|email', |
|
175 | - 'password' => 'required|confirmed|min:6', |
|
176 | - 'password_confirmation' => 'required', |
|
177 | - ]); |
|
164 | + /** |
|
165 | + * Reset the given user's password. |
|
166 | + * |
|
167 | + * @param \Illuminate\Http\Request $request |
|
168 | + * @return \Illuminate\Http\Response |
|
169 | + */ |
|
170 | + public function resetpassword(Request $request) |
|
171 | + { |
|
172 | + $this->validate($request, [ |
|
173 | + 'token' => 'required', |
|
174 | + 'email' => 'required|email', |
|
175 | + 'password' => 'required|confirmed|min:6', |
|
176 | + 'password_confirmation' => 'required', |
|
177 | + ]); |
|
178 | 178 | |
179 | - return \Response::json(\Core::users()->resetPassword($request->only('email', 'password', 'password_confirmation', 'token')), 200); |
|
180 | - } |
|
179 | + return \Response::json(\Core::users()->resetPassword($request->only('email', 'password', 'password_confirmation', 'token')), 200); |
|
180 | + } |
|
181 | 181 | |
182 | - /** |
|
183 | - * Change the logged in user password. |
|
184 | - * |
|
185 | - * @param \Illuminate\Http\Request $request |
|
186 | - * @return \Illuminate\Http\Response |
|
187 | - */ |
|
188 | - public function changePassword(Request $request) |
|
189 | - { |
|
190 | - $this->validate($request, [ |
|
191 | - 'old_password' => 'required', |
|
192 | - 'password' => 'required|confirmed|min:6', |
|
193 | - 'password_confirmation' => 'required', |
|
194 | - ]); |
|
182 | + /** |
|
183 | + * Change the logged in user password. |
|
184 | + * |
|
185 | + * @param \Illuminate\Http\Request $request |
|
186 | + * @return \Illuminate\Http\Response |
|
187 | + */ |
|
188 | + public function changePassword(Request $request) |
|
189 | + { |
|
190 | + $this->validate($request, [ |
|
191 | + 'old_password' => 'required', |
|
192 | + 'password' => 'required|confirmed|min:6', |
|
193 | + 'password_confirmation' => 'required', |
|
194 | + ]); |
|
195 | 195 | |
196 | - return \Response::json(\Core::users()->changePassword($request->only('old_password', 'password', 'password_confirmation')), 200); |
|
197 | - } |
|
196 | + return \Response::json(\Core::users()->changePassword($request->only('old_password', 'password', 'password_confirmation')), 200); |
|
197 | + } |
|
198 | 198 | |
199 | - /** |
|
200 | - * Refresh the expired login token. |
|
201 | - * |
|
202 | - * @return \Illuminate\Http\Response |
|
203 | - */ |
|
204 | - public function refreshtoken() |
|
205 | - { |
|
206 | - return \Response::json(\Core::users()->refreshtoken(), 200); |
|
207 | - } |
|
199 | + /** |
|
200 | + * Refresh the expired login token. |
|
201 | + * |
|
202 | + * @return \Illuminate\Http\Response |
|
203 | + */ |
|
204 | + public function refreshtoken() |
|
205 | + { |
|
206 | + return \Response::json(\Core::users()->refreshtoken(), 200); |
|
207 | + } |
|
208 | 208 | |
209 | - /** |
|
210 | - * Paginate all users with inthe given group. |
|
211 | - * |
|
212 | - * @param \Illuminate\Http\Request $request |
|
213 | - * @param string $groupName |
|
214 | - * @param integer $perPage |
|
215 | - * @param string $sortBy |
|
216 | - * @param boolean $desc |
|
217 | - * @return \Illuminate\Http\Response |
|
218 | - */ |
|
219 | - public function group(Request $request, $groupName, $perPage = false, $sortBy = 'created_at', $desc = 1) |
|
220 | - { |
|
221 | - return \Response::json(\Core::users()->group($request->all(), $groupName, $this->relations, $perPage, $sortBy, $desc), 200); |
|
222 | - } |
|
209 | + /** |
|
210 | + * Paginate all users with inthe given group. |
|
211 | + * |
|
212 | + * @param \Illuminate\Http\Request $request |
|
213 | + * @param string $groupName |
|
214 | + * @param integer $perPage |
|
215 | + * @param string $sortBy |
|
216 | + * @param boolean $desc |
|
217 | + * @return \Illuminate\Http\Response |
|
218 | + */ |
|
219 | + public function group(Request $request, $groupName, $perPage = false, $sortBy = 'created_at', $desc = 1) |
|
220 | + { |
|
221 | + return \Response::json(\Core::users()->group($request->all(), $groupName, $this->relations, $perPage, $sortBy, $desc), 200); |
|
222 | + } |
|
223 | 223 | |
224 | - /** |
|
225 | - * Save the given data to the logged in user. |
|
226 | - * |
|
227 | - * @param \Illuminate\Http\Request $request |
|
228 | - * @return \Illuminate\Http\Response |
|
229 | - */ |
|
230 | - public function saveProfile(Request $request) |
|
231 | - { |
|
232 | - foreach ($this->validationRules as &$rule) |
|
233 | - { |
|
234 | - if (strpos($rule, 'exists') && ! strpos($rule, 'deleted_at,NULL')) |
|
235 | - { |
|
236 | - $rule .= ',deleted_at,NULL'; |
|
237 | - } |
|
224 | + /** |
|
225 | + * Save the given data to the logged in user. |
|
226 | + * |
|
227 | + * @param \Illuminate\Http\Request $request |
|
228 | + * @return \Illuminate\Http\Response |
|
229 | + */ |
|
230 | + public function saveProfile(Request $request) |
|
231 | + { |
|
232 | + foreach ($this->validationRules as &$rule) |
|
233 | + { |
|
234 | + if (strpos($rule, 'exists') && ! strpos($rule, 'deleted_at,NULL')) |
|
235 | + { |
|
236 | + $rule .= ',deleted_at,NULL'; |
|
237 | + } |
|
238 | 238 | |
239 | - if ($request->has('id')) |
|
240 | - { |
|
241 | - $rule = str_replace('{id}', $request->get('id'), $rule); |
|
242 | - } |
|
243 | - else |
|
244 | - { |
|
245 | - $rule = str_replace(',{id}', '', $rule); |
|
246 | - } |
|
247 | - } |
|
239 | + if ($request->has('id')) |
|
240 | + { |
|
241 | + $rule = str_replace('{id}', $request->get('id'), $rule); |
|
242 | + } |
|
243 | + else |
|
244 | + { |
|
245 | + $rule = str_replace(',{id}', '', $rule); |
|
246 | + } |
|
247 | + } |
|
248 | 248 | |
249 | - $this->validate($request, $this->validationRules); |
|
249 | + $this->validate($request, $this->validationRules); |
|
250 | 250 | |
251 | - if ($this->model) |
|
252 | - { |
|
253 | - return \Response::json(call_user_func_array("\Core::{$this->model}", [])->saveProfile($request->all()), 200); |
|
254 | - } |
|
255 | - } |
|
251 | + if ($this->model) |
|
252 | + { |
|
253 | + return \Response::json(call_user_func_array("\Core::{$this->model}", [])->saveProfile($request->all()), 200); |
|
254 | + } |
|
255 | + } |
|
256 | 256 | } |
@@ -5,44 +5,44 @@ |
||
5 | 5 | */ |
6 | 6 | class ReprotObserver { |
7 | 7 | |
8 | - public function saving($model) |
|
9 | - { |
|
10 | - // |
|
11 | - } |
|
12 | - |
|
13 | - public function saved($model) |
|
14 | - { |
|
15 | - // |
|
16 | - } |
|
17 | - |
|
18 | - public function creating($model) |
|
19 | - { |
|
20 | - // |
|
21 | - } |
|
22 | - |
|
23 | - public function created($model) |
|
24 | - { |
|
25 | - // |
|
26 | - } |
|
27 | - |
|
28 | - public function updating($model) |
|
29 | - { |
|
30 | - // |
|
31 | - } |
|
32 | - |
|
33 | - public function updated($model) |
|
34 | - { |
|
35 | - // |
|
36 | - } |
|
37 | - |
|
38 | - public function deleting($model) |
|
39 | - { |
|
40 | - // |
|
41 | - } |
|
42 | - |
|
43 | - public function deleted($model) |
|
44 | - { |
|
45 | - // |
|
46 | - } |
|
8 | + public function saving($model) |
|
9 | + { |
|
10 | + // |
|
11 | + } |
|
12 | + |
|
13 | + public function saved($model) |
|
14 | + { |
|
15 | + // |
|
16 | + } |
|
17 | + |
|
18 | + public function creating($model) |
|
19 | + { |
|
20 | + // |
|
21 | + } |
|
22 | + |
|
23 | + public function created($model) |
|
24 | + { |
|
25 | + // |
|
26 | + } |
|
27 | + |
|
28 | + public function updating($model) |
|
29 | + { |
|
30 | + // |
|
31 | + } |
|
32 | + |
|
33 | + public function updated($model) |
|
34 | + { |
|
35 | + // |
|
36 | + } |
|
37 | + |
|
38 | + public function deleting($model) |
|
39 | + { |
|
40 | + // |
|
41 | + } |
|
42 | + |
|
43 | + public function deleted($model) |
|
44 | + { |
|
45 | + // |
|
46 | + } |
|
47 | 47 | |
48 | 48 | } |
49 | 49 | \ No newline at end of file |
@@ -13,65 +13,65 @@ |
||
13 | 13 | public function up() |
14 | 14 | { |
15 | 15 | /** |
16 | - * Insert the permissions related to this module. |
|
17 | - */ |
|
18 | - DB::table('permissions')->insert( |
|
19 | - [ |
|
20 | - /** |
|
21 | - * Reporting model permissions. |
|
22 | - */ |
|
23 | - [ |
|
24 | - 'name' => 'find', |
|
25 | - 'model' => 'reports', |
|
26 | - 'created_at' => \DB::raw('NOW()'), |
|
27 | - 'updated_at' => \DB::raw('NOW()') |
|
28 | - ], |
|
29 | - [ |
|
30 | - 'name' => 'search', |
|
31 | - 'model' => 'reports', |
|
32 | - 'created_at' => \DB::raw('NOW()'), |
|
33 | - 'updated_at' => \DB::raw('NOW()') |
|
34 | - ], |
|
35 | - [ |
|
36 | - 'name' => 'list', |
|
37 | - 'model' => 'reports', |
|
38 | - 'created_at' => \DB::raw('NOW()'), |
|
39 | - 'updated_at' => \DB::raw('NOW()') |
|
40 | - ], |
|
41 | - [ |
|
42 | - 'name' => 'findby', |
|
43 | - 'model' => 'reports', |
|
44 | - 'created_at' => \DB::raw('NOW()'), |
|
45 | - 'updated_at' => \DB::raw('NOW()') |
|
46 | - ], |
|
47 | - [ |
|
48 | - 'name' => 'first', |
|
49 | - 'model' => 'reports', |
|
50 | - 'created_at' => \DB::raw('NOW()'), |
|
51 | - 'updated_at' => \DB::raw('NOW()') |
|
52 | - ], |
|
53 | - [ |
|
54 | - 'name' => 'paginate', |
|
55 | - 'model' => 'reports', |
|
56 | - 'created_at' => \DB::raw('NOW()'), |
|
57 | - 'updated_at' => \DB::raw('NOW()') |
|
58 | - ], |
|
59 | - [ |
|
60 | - 'name' => 'paginateby', |
|
61 | - 'model' => 'reports', |
|
62 | - 'created_at' => \DB::raw('NOW()'), |
|
63 | - 'updated_at' => \DB::raw('NOW()') |
|
64 | - ], |
|
65 | - [ |
|
66 | - 'name' => 'admin_count', |
|
67 | - 'model' => 'reports', |
|
68 | - 'created_at' => \DB::raw('NOW()'), |
|
69 | - 'updated_at' => \DB::raw('NOW()') |
|
70 | - ] |
|
71 | - ] |
|
72 | - ); |
|
16 | + * Insert the permissions related to this module. |
|
17 | + */ |
|
18 | + DB::table('permissions')->insert( |
|
19 | + [ |
|
20 | + /** |
|
21 | + * Reporting model permissions. |
|
22 | + */ |
|
23 | + [ |
|
24 | + 'name' => 'find', |
|
25 | + 'model' => 'reports', |
|
26 | + 'created_at' => \DB::raw('NOW()'), |
|
27 | + 'updated_at' => \DB::raw('NOW()') |
|
28 | + ], |
|
29 | + [ |
|
30 | + 'name' => 'search', |
|
31 | + 'model' => 'reports', |
|
32 | + 'created_at' => \DB::raw('NOW()'), |
|
33 | + 'updated_at' => \DB::raw('NOW()') |
|
34 | + ], |
|
35 | + [ |
|
36 | + 'name' => 'list', |
|
37 | + 'model' => 'reports', |
|
38 | + 'created_at' => \DB::raw('NOW()'), |
|
39 | + 'updated_at' => \DB::raw('NOW()') |
|
40 | + ], |
|
41 | + [ |
|
42 | + 'name' => 'findby', |
|
43 | + 'model' => 'reports', |
|
44 | + 'created_at' => \DB::raw('NOW()'), |
|
45 | + 'updated_at' => \DB::raw('NOW()') |
|
46 | + ], |
|
47 | + [ |
|
48 | + 'name' => 'first', |
|
49 | + 'model' => 'reports', |
|
50 | + 'created_at' => \DB::raw('NOW()'), |
|
51 | + 'updated_at' => \DB::raw('NOW()') |
|
52 | + ], |
|
53 | + [ |
|
54 | + 'name' => 'paginate', |
|
55 | + 'model' => 'reports', |
|
56 | + 'created_at' => \DB::raw('NOW()'), |
|
57 | + 'updated_at' => \DB::raw('NOW()') |
|
58 | + ], |
|
59 | + [ |
|
60 | + 'name' => 'paginateby', |
|
61 | + 'model' => 'reports', |
|
62 | + 'created_at' => \DB::raw('NOW()'), |
|
63 | + 'updated_at' => \DB::raw('NOW()') |
|
64 | + ], |
|
65 | + [ |
|
66 | + 'name' => 'admin_count', |
|
67 | + 'model' => 'reports', |
|
68 | + 'created_at' => \DB::raw('NOW()'), |
|
69 | + 'updated_at' => \DB::raw('NOW()') |
|
70 | + ] |
|
71 | + ] |
|
72 | + ); |
|
73 | 73 | |
74 | - /** |
|
74 | + /** |
|
75 | 75 | * Assign the permissions to the admin group. |
76 | 76 | */ |
77 | 77 | $permissionIds = DB::table('permissions')->whereIn('model', ['reports'])->select('id')->pluck('id'); |
@@ -96,7 +96,7 @@ |
||
96 | 96 | */ |
97 | 97 | public function down() |
98 | 98 | { |
99 | - $permissions = DB::table('permissions')->whereIn('model', ['reports']); |
|
99 | + $permissions = DB::table('permissions')->whereIn('model', ['reports']); |
|
100 | 100 | DB::table('groups_permissions')->whereIn('permission_id', $permissions->pluck('id'))->delete(); |
101 | 101 | $permissions->delete(); |
102 | 102 | } |
@@ -7,23 +7,23 @@ |
||
7 | 7 | class ModuleServiceProvider extends ServiceProvider |
8 | 8 | { |
9 | 9 | /** |
10 | - * Bootstrap the module services. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function boot() |
|
15 | - { |
|
16 | - $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'catalog'); |
|
17 | - $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'catalog'); |
|
18 | - } |
|
10 | + * Bootstrap the module services. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function boot() |
|
15 | + { |
|
16 | + $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'catalog'); |
|
17 | + $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'catalog'); |
|
18 | + } |
|
19 | 19 | |
20 | - /** |
|
21 | - * Register the module services. |
|
22 | - * |
|
23 | - * @return void |
|
24 | - */ |
|
25 | - public function register() |
|
26 | - { |
|
27 | - $this->app->register(RouteServiceProvider::class); |
|
28 | - } |
|
20 | + /** |
|
21 | + * Register the module services. |
|
22 | + * |
|
23 | + * @return void |
|
24 | + */ |
|
25 | + public function register() |
|
26 | + { |
|
27 | + $this->app->register(RouteServiceProvider::class); |
|
28 | + } |
|
29 | 29 | } |
@@ -5,44 +5,44 @@ |
||
5 | 5 | */ |
6 | 6 | class PushNotificationDeviceObserver { |
7 | 7 | |
8 | - public function saving($model) |
|
9 | - { |
|
10 | - // |
|
11 | - } |
|
12 | - |
|
13 | - public function saved($model) |
|
14 | - { |
|
15 | - // |
|
16 | - } |
|
17 | - |
|
18 | - public function creating($model) |
|
19 | - { |
|
20 | - // |
|
21 | - } |
|
22 | - |
|
23 | - public function created($model) |
|
24 | - { |
|
25 | - // |
|
26 | - } |
|
27 | - |
|
28 | - public function updating($model) |
|
29 | - { |
|
30 | - // |
|
31 | - } |
|
32 | - |
|
33 | - public function updated($model) |
|
34 | - { |
|
35 | - // |
|
36 | - } |
|
37 | - |
|
38 | - public function deleting($model) |
|
39 | - { |
|
40 | - // |
|
41 | - } |
|
42 | - |
|
43 | - public function deleted($model) |
|
44 | - { |
|
45 | - // |
|
46 | - } |
|
8 | + public function saving($model) |
|
9 | + { |
|
10 | + // |
|
11 | + } |
|
12 | + |
|
13 | + public function saved($model) |
|
14 | + { |
|
15 | + // |
|
16 | + } |
|
17 | + |
|
18 | + public function creating($model) |
|
19 | + { |
|
20 | + // |
|
21 | + } |
|
22 | + |
|
23 | + public function created($model) |
|
24 | + { |
|
25 | + // |
|
26 | + } |
|
27 | + |
|
28 | + public function updating($model) |
|
29 | + { |
|
30 | + // |
|
31 | + } |
|
32 | + |
|
33 | + public function updated($model) |
|
34 | + { |
|
35 | + // |
|
36 | + } |
|
37 | + |
|
38 | + public function deleting($model) |
|
39 | + { |
|
40 | + // |
|
41 | + } |
|
42 | + |
|
43 | + public function deleted($model) |
|
44 | + { |
|
45 | + // |
|
46 | + } |
|
47 | 47 | |
48 | 48 | } |
49 | 49 | \ No newline at end of file |
@@ -21,7 +21,7 @@ |
||
21 | 21 | $table->unique(array('device_token', 'device_type')); |
22 | 22 | $table->softDeletes(); |
23 | 23 | $table->timestamps(); |
24 | - }); |
|
24 | + }); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -12,7 +12,7 @@ |
||
12 | 12 | */ |
13 | 13 | public function up() |
14 | 14 | { |
15 | - Schema::create('push_notifications_devices', function (Blueprint $table) { |
|
15 | + Schema::create('push_notifications_devices', function(Blueprint $table) { |
|
16 | 16 | $table->increments('id'); |
17 | 17 | $table->string('device_token'); |
18 | 18 | $table->enum('device_type', ['android', 'ios']); |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | return [ |
4 | 4 | |
5 | - /** |
|
6 | - * Here goes your notification messages. |
|
7 | - */ |
|
5 | + /** |
|
6 | + * Here goes your notification messages. |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | ]; |
10 | 10 | \ No newline at end of file |