Completed
Push — master ( cd8f65...e1eb39 )
by Sherif
27:44
created
src/Modules/V1/Acl/Repositories/GroupRepository.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -29,24 +29,24 @@
 block discarded – undo
29 29
 			$group->permissions()->attach($permissionIds);
30 30
 		});
31 31
 
32
-        return $this->find($group_id);
32
+		return $this->find($group_id);
33 33
 	}
34 34
 
35 35
 	/**
36
-     *  Return the users in the given group in pages.
37
-     * 
38
-     * @param  integer $groupId
39
-     * @param  integer $perPage
40
-     * @param  array   $relations
41
-     * @param  string  $sortBy
42
-     * @param  boolean $desc
43
-     * @return collection
44
-     */
45
-    public function users($groupId, $perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 1)
46
-    {
36
+	 *  Return the users in the given group in pages.
37
+	 * 
38
+	 * @param  integer $groupId
39
+	 * @param  integer $perPage
40
+	 * @param  array   $relations
41
+	 * @param  string  $sortBy
42
+	 * @param  boolean $desc
43
+	 * @return collection
44
+	 */
45
+	public function users($groupId, $perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 1)
46
+	{
47 47
 		$group = $this->find($groupId);
48 48
 		$sort  = $desc ? 'desc' : 'asc';
49 49
 
50
-        return $group->users()->with($relations)->orderBy($sortBy, $sort)->paginate($perPage);
51
-    }
50
+		return $group->users()->with($relations)->orderBy($sortBy, $sort)->paginate($perPage);
51
+	}
52 52
 }
Please login to merge, or discard this patch.
src/Modules/V1/Acl/ModelObservers/AclGroupObserver.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -5,62 +5,62 @@
 block discarded – undo
5 5
  */
6 6
 class AclGroupObserver {
7 7
 
8
-    public function saving($model)
9
-    {
10
-        //
11
-    }
8
+	public function saving($model)
9
+	{
10
+		//
11
+	}
12 12
 
13
-    public function saved($model)
14
-    {
15
-        //
16
-    }
13
+	public function saved($model)
14
+	{
15
+		//
16
+	}
17 17
 
18
-    public function creating($model)
19
-    {
20
-        //
21
-    }
18
+	public function creating($model)
19
+	{
20
+		//
21
+	}
22 22
 
23
-    public function created($model)
24
-    {
25
-        //
26
-    }
23
+	public function created($model)
24
+	{
25
+		//
26
+	}
27 27
 
28
-    /**
29
-     * Prevent updating of the admin group.
30
-     * 
31
-     * @param  object $model the model beign updated.
32
-     * @return void
33
-     */
34
-    public function updating($model)
35
-    {
36
-        if ($model->getOriginal('name') == 'Admin') 
37
-        {
38
-            \ErrorHandler::noPermissions();
39
-        }
40
-    }
28
+	/**
29
+	 * Prevent updating of the admin group.
30
+	 * 
31
+	 * @param  object $model the model beign updated.
32
+	 * @return void
33
+	 */
34
+	public function updating($model)
35
+	{
36
+		if ($model->getOriginal('name') == 'Admin') 
37
+		{
38
+			\ErrorHandler::noPermissions();
39
+		}
40
+	}
41 41
 
42
-    public function updated($model)
43
-    {
44
-        //
45
-    }
42
+	public function updated($model)
43
+	{
44
+		//
45
+	}
46 46
 
47
-    /**
48
-     * Prevent deleting the admin group.
49
-     * 
50
-     * @param  object $model the delted model.
51
-     * @return void
52
-     */
53
-    public function deleting($model)
54
-    {
55
-        if ($model->getOriginal('name') == 'Admin') 
56
-        {
57
-            \ErrorHandler::noPermissions();
58
-        }
59
-    }
47
+	/**
48
+	 * Prevent deleting the admin group.
49
+	 * 
50
+	 * @param  object $model the delted model.
51
+	 * @return void
52
+	 */
53
+	public function deleting($model)
54
+	{
55
+		if ($model->getOriginal('name') == 'Admin') 
56
+		{
57
+			\ErrorHandler::noPermissions();
58
+		}
59
+	}
60 60
 
61
-    public function deleted($model)
62
-    {
63
-        //
64
-    }
61
+	public function deleted($model)
62
+	{
63
+		//
64
+	}
65 65
 
66 66
 }
67 67
\ No newline at end of file
Please login to merge, or discard this patch.
src/Modules/V1/Acl/ModelObservers/AclUserObserver.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -5,54 +5,54 @@
 block discarded – undo
5 5
  */
6 6
 class AclUserObserver {
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
-    /**
39
-     * Soft delete user logs.
40
-     * 
41
-     * @param  object $model the delted model.
42
-     * @return void
43
-     */
44
-    public function deleting($model)
45
-    {
46
-        if ($model->getOriginal('id') == \JWTAuth::parseToken()->authenticate()->id) 
47
-        {
48
-            \ErrorHandler::noPermissions();
49
-        }
50
-        $model->logs()->delete();
51
-    }
52
-
53
-    public function deleted($model)
54
-    {
55
-        //
56
-    }
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
+	/**
39
+	 * Soft delete user logs.
40
+	 * 
41
+	 * @param  object $model the delted model.
42
+	 * @return void
43
+	 */
44
+	public function deleting($model)
45
+	{
46
+		if ($model->getOriginal('id') == \JWTAuth::parseToken()->authenticate()->id) 
47
+		{
48
+			\ErrorHandler::noPermissions();
49
+		}
50
+		$model->logs()->delete();
51
+	}
52
+
53
+	public function deleted($model)
54
+	{
55
+		//
56
+	}
57 57
 
58 58
 }
59 59
\ No newline at end of file
Please login to merge, or discard this patch.
src/Modules/V1/Acl/Database/Migrations/2016_01_05_130507_initialize_acl.php 1 patch
Indentation   +203 added lines, -203 removed lines patch added patch discarded remove patch
@@ -13,203 +13,203 @@  discard block
 block discarded – undo
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
-	        	],
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 95
 
96
-	        	/**
97
-        		 * Permissions model permissions.
98
-        		 */
99
-        		[
100
-	        	'name'       => 'find',
101
-	        	'model'      => 'permissions',
102
-	        	'created_at' => \DB::raw('NOW()'),
103
-	        	'updated_at' => \DB::raw('NOW()')
104
-	        	],
105
-	        	[
106
-	        	'name'       => 'search',
107
-	        	'model'      => 'permissions',
108
-	        	'created_at' => \DB::raw('NOW()'),
109
-	        	'updated_at' => \DB::raw('NOW()')
110
-	        	],
111
-	        	[
112
-	        	'name'       => 'list',
113
-	        	'model'      => 'permissions',
114
-	        	'created_at' => \DB::raw('NOW()'),
115
-	        	'updated_at' => \DB::raw('NOW()')
116
-	        	],
117
-	        	[
118
-	        	'name'       => 'findby',
119
-	        	'model'      => 'permissions',
120
-	        	'created_at' => \DB::raw('NOW()'),
121
-	        	'updated_at' => \DB::raw('NOW()')
122
-	        	],
123
-	        	[
124
-	        	'name'       => 'first',
125
-	        	'model'      => 'permissions',
126
-	        	'created_at' => \DB::raw('NOW()'),
127
-	        	'updated_at' => \DB::raw('NOW()')
128
-	        	],
129
-	        	[
130
-	        	'name'       => 'paginate',
131
-	        	'model'      => 'permissions',
132
-	        	'created_at' => \DB::raw('NOW()'),
133
-	        	'updated_at' => \DB::raw('NOW()')
134
-	        	],
135
-	        	[
136
-	        	'name'       => 'paginateby',
137
-	        	'model'      => 'permissions',
138
-	        	'created_at' => \DB::raw('NOW()'),
139
-	        	'updated_at' => \DB::raw('NOW()')
140
-	        	],
96
+				/**
97
+				 * Permissions model permissions.
98
+				 */
99
+				[
100
+				'name'       => 'find',
101
+				'model'      => 'permissions',
102
+				'created_at' => \DB::raw('NOW()'),
103
+				'updated_at' => \DB::raw('NOW()')
104
+				],
105
+				[
106
+				'name'       => 'search',
107
+				'model'      => 'permissions',
108
+				'created_at' => \DB::raw('NOW()'),
109
+				'updated_at' => \DB::raw('NOW()')
110
+				],
111
+				[
112
+				'name'       => 'list',
113
+				'model'      => 'permissions',
114
+				'created_at' => \DB::raw('NOW()'),
115
+				'updated_at' => \DB::raw('NOW()')
116
+				],
117
+				[
118
+				'name'       => 'findby',
119
+				'model'      => 'permissions',
120
+				'created_at' => \DB::raw('NOW()'),
121
+				'updated_at' => \DB::raw('NOW()')
122
+				],
123
+				[
124
+				'name'       => 'first',
125
+				'model'      => 'permissions',
126
+				'created_at' => \DB::raw('NOW()'),
127
+				'updated_at' => \DB::raw('NOW()')
128
+				],
129
+				[
130
+				'name'       => 'paginate',
131
+				'model'      => 'permissions',
132
+				'created_at' => \DB::raw('NOW()'),
133
+				'updated_at' => \DB::raw('NOW()')
134
+				],
135
+				[
136
+				'name'       => 'paginateby',
137
+				'model'      => 'permissions',
138
+				'created_at' => \DB::raw('NOW()'),
139
+				'updated_at' => \DB::raw('NOW()')
140
+				],
141 141
 
142
-	        	/**
143
-        		 * Groups model permissions.
144
-        		 */
145
-	        	[
146
-	        	'name'       => 'save',
147
-	        	'model'      => 'groups',
148
-	        	'created_at' => \DB::raw('NOW()'),
149
-	        	'updated_at' => \DB::raw('NOW()')
150
-	        	],
151
-	        	[
152
-	        	'name'       => 'delete',
153
-	        	'model'      => 'groups',
154
-	        	'created_at' => \DB::raw('NOW()'),
155
-	        	'updated_at' => \DB::raw('NOW()')
156
-	        	],
157
-	        	[
158
-	        	'name'       => 'find',
159
-	        	'model'      => 'groups',
160
-	        	'created_at' => \DB::raw('NOW()'),
161
-	        	'updated_at' => \DB::raw('NOW()')
162
-	        	],
163
-	        	[
164
-	        	'name'       => 'search',
165
-	        	'model'      => 'groups',
166
-	        	'created_at' => \DB::raw('NOW()'),
167
-	        	'updated_at' => \DB::raw('NOW()')
168
-	        	],
169
-	        	[
170
-	        	'name'       => 'list',
171
-	        	'model'      => 'groups',
172
-	        	'created_at' => \DB::raw('NOW()'),
173
-	        	'updated_at' => \DB::raw('NOW()')
174
-	        	],
175
-	        	[
176
-	        	'name'       => 'findby',
177
-	        	'model'      => 'groups',
178
-	        	'created_at' => \DB::raw('NOW()'),
179
-	        	'updated_at' => \DB::raw('NOW()')
180
-	        	],
181
-	        	[
182
-	        	'name'       => 'first',
183
-	        	'model'      => 'groups',
184
-	        	'created_at' => \DB::raw('NOW()'),
185
-	        	'updated_at' => \DB::raw('NOW()')
186
-	        	],
187
-	        	[
188
-	        	'name'       => 'paginate',
189
-	        	'model'      => 'groups',
190
-	        	'created_at' => \DB::raw('NOW()'),
191
-	        	'updated_at' => \DB::raw('NOW()')
192
-	        	],
193
-	        	[
194
-	        	'name'       => 'paginateby',
195
-	        	'model'      => 'groups',
196
-	        	'created_at' => \DB::raw('NOW()'),
197
-	        	'updated_at' => \DB::raw('NOW()')
198
-	        	],
199
-	        	[
200
-	        	'name'       => 'assignpermissions',
201
-	        	'model'      => 'groups',
202
-	        	'created_at' => \DB::raw('NOW()'),
203
-	        	'updated_at' => \DB::raw('NOW()')
204
-	        	],
205
-	        	[
206
-	        	'name'       => 'users',
207
-	        	'model'      => 'groups',
208
-	        	'created_at' => \DB::raw('NOW()'),
209
-	        	'updated_at' => \DB::raw('NOW()')
210
-	        	],
211
-        	]
212
-        );
142
+				/**
143
+				 * Groups model permissions.
144
+				 */
145
+				[
146
+				'name'       => 'save',
147
+				'model'      => 'groups',
148
+				'created_at' => \DB::raw('NOW()'),
149
+				'updated_at' => \DB::raw('NOW()')
150
+				],
151
+				[
152
+				'name'       => 'delete',
153
+				'model'      => 'groups',
154
+				'created_at' => \DB::raw('NOW()'),
155
+				'updated_at' => \DB::raw('NOW()')
156
+				],
157
+				[
158
+				'name'       => 'find',
159
+				'model'      => 'groups',
160
+				'created_at' => \DB::raw('NOW()'),
161
+				'updated_at' => \DB::raw('NOW()')
162
+				],
163
+				[
164
+				'name'       => 'search',
165
+				'model'      => 'groups',
166
+				'created_at' => \DB::raw('NOW()'),
167
+				'updated_at' => \DB::raw('NOW()')
168
+				],
169
+				[
170
+				'name'       => 'list',
171
+				'model'      => 'groups',
172
+				'created_at' => \DB::raw('NOW()'),
173
+				'updated_at' => \DB::raw('NOW()')
174
+				],
175
+				[
176
+				'name'       => 'findby',
177
+				'model'      => 'groups',
178
+				'created_at' => \DB::raw('NOW()'),
179
+				'updated_at' => \DB::raw('NOW()')
180
+				],
181
+				[
182
+				'name'       => 'first',
183
+				'model'      => 'groups',
184
+				'created_at' => \DB::raw('NOW()'),
185
+				'updated_at' => \DB::raw('NOW()')
186
+				],
187
+				[
188
+				'name'       => 'paginate',
189
+				'model'      => 'groups',
190
+				'created_at' => \DB::raw('NOW()'),
191
+				'updated_at' => \DB::raw('NOW()')
192
+				],
193
+				[
194
+				'name'       => 'paginateby',
195
+				'model'      => 'groups',
196
+				'created_at' => \DB::raw('NOW()'),
197
+				'updated_at' => \DB::raw('NOW()')
198
+				],
199
+				[
200
+				'name'       => 'assignpermissions',
201
+				'model'      => 'groups',
202
+				'created_at' => \DB::raw('NOW()'),
203
+				'updated_at' => \DB::raw('NOW()')
204
+				],
205
+				[
206
+				'name'       => 'users',
207
+				'model'      => 'groups',
208
+				'created_at' => \DB::raw('NOW()'),
209
+				'updated_at' => \DB::raw('NOW()')
210
+				],
211
+			]
212
+		);
213 213
 
214 214
 		/**
215 215
 		 * Delete previous data.
@@ -237,29 +237,29 @@  discard block
 block discarded – undo
237 237
 		 * Create Default users.
238 238
 		 */
239 239
 		$adminUserId = DB::table('users')->insertGetId(
240
-            [
240
+			[
241 241
 			'email'      => '[email protected]',
242 242
 			'password'   => bcrypt('123456'),
243 243
 			'created_at' => \DB::raw('NOW()'),
244 244
 			'updated_at' => \DB::raw('NOW()')
245 245
 			]
246
-        );
246
+		);
247 247
 
248 248
 		/**
249 249
 		 * Assign users to groups.
250 250
 		 */
251 251
 		DB::table('users_groups')->insert(
252
-        	[
253
-	            [
252
+			[
253
+				[
254 254
 				'user_id'    => $adminUserId,
255 255
 				'group_id'   => $adminGroupId,
256 256
 				'created_at' => \DB::raw('NOW()'),
257 257
 				'updated_at' => \DB::raw('NOW()')
258
-	            ]
259
-        	]
260
-        );
258
+				]
259
+			]
260
+		);
261 261
 
262
-        /**
262
+		/**
263 263
 		 * Assign the permissions to the admin group.
264 264
 		 */
265 265
 		$permissionIds = DB::table('permissions')->whereIn('model', ['users', 'permissions', 'groups'])->select('id')->lists('id');
Please login to merge, or discard this patch.
src/Modules/V1/Acl/Database/Migrations/2015_12_20_124153_users.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -13,15 +13,15 @@
 block discarded – undo
13 13
 	public function up()
14 14
 	{
15 15
 		Schema::create('users', function (Blueprint $table) {
16
-            $table->increments('id');
17
-            $table->string('name',100);
18
-            $table->string('email')->unique();
19
-            $table->string('password', 60);
20
-            $table->boolean('blocked', 0);
21
-            $table->softDeletes();
22
-            $table->rememberToken();
23
-            $table->timestamps();
24
-        });
16
+			$table->increments('id');
17
+			$table->string('name',100);
18
+			$table->string('email')->unique();
19
+			$table->string('password', 60);
20
+			$table->boolean('blocked', 0);
21
+			$table->softDeletes();
22
+			$table->rememberToken();
23
+			$table->timestamps();
24
+		});
25 25
 	}
26 26
 
27 27
 	/**
Please login to merge, or discard this patch.
src/Modules/V1/Acl/AclUser.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -6,53 +6,53 @@
 block discarded – undo
6 6
 
7 7
 class AclUser extends User {
8 8
 
9
-    use SoftDeletes;
10
-    protected $table    = 'users';
11
-    protected $dates    = ['created_at', 'updated_at', 'deleted_at'];
12
-    protected $hidden   = ['password', 'remember_token','deleted_at'];
13
-    protected $guarded  = ['id'];
14
-    protected $fillable = ['name', 'email', 'password'];
15
-    public $searchable  = ['name', 'email'];
9
+	use SoftDeletes;
10
+	protected $table    = 'users';
11
+	protected $dates    = ['created_at', 'updated_at', 'deleted_at'];
12
+	protected $hidden   = ['password', 'remember_token','deleted_at'];
13
+	protected $guarded  = ['id'];
14
+	protected $fillable = ['name', 'email', 'password'];
15
+	public $searchable  = ['name', 'email'];
16 16
     
17
-    public function getCreatedAtAttribute($value)
18
-    {
19
-        return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
20
-    }
21
-
22
-    public function getUpdatedAtAttribute($value)
23
-    {
24
-        return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
25
-    }
26
-
27
-    public function getDeletedAtAttribute($value)
28
-    {
29
-        return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
30
-    }
31
-
32
-    /**
33
-     * Encrypt the password attribute before
34
-     * saving it in the storage.
35
-     * 
36
-     * @param string $value 
37
-     */
38
-    public function setPasswordAttribute($value)
39
-    {
40
-        $this->attributes['password'] = bcrypt($value);
41
-    }
42
-
43
-    public function logs()
44
-    {
45
-        return $this->hasMany('App\Modules\V1\Core\Log', 'user_id');
46
-    }
47
-
48
-    public function groups()
49
-    {
50
-        return $this->belongsToMany('\App\Modules\V1\Acl\AclGroup','users_groups','user_id','group_id')->whereNull('users_groups.deleted_at')->withTimestamps();
51
-    }
17
+	public function getCreatedAtAttribute($value)
18
+	{
19
+		return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
20
+	}
21
+
22
+	public function getUpdatedAtAttribute($value)
23
+	{
24
+		return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
25
+	}
26
+
27
+	public function getDeletedAtAttribute($value)
28
+	{
29
+		return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
30
+	}
31
+
32
+	/**
33
+	 * Encrypt the password attribute before
34
+	 * saving it in the storage.
35
+	 * 
36
+	 * @param string $value 
37
+	 */
38
+	public function setPasswordAttribute($value)
39
+	{
40
+		$this->attributes['password'] = bcrypt($value);
41
+	}
42
+
43
+	public function logs()
44
+	{
45
+		return $this->hasMany('App\Modules\V1\Core\Log', 'user_id');
46
+	}
47
+
48
+	public function groups()
49
+	{
50
+		return $this->belongsToMany('\App\Modules\V1\Acl\AclGroup','users_groups','user_id','group_id')->whereNull('users_groups.deleted_at')->withTimestamps();
51
+	}
52 52
     
53
-    public static function boot()
54
-    {
55
-        parent::boot();
56
-        parent::observe(\App::make('App\Modules\V1\Acl\ModelObservers\AclUserObserver'));
57
-    }
53
+	public static function boot()
54
+	{
55
+		parent::boot();
56
+		parent::observe(\App::make('App\Modules\V1\Acl\ModelObservers\AclUserObserver'));
57
+	}
58 58
 }
Please login to merge, or discard this patch.
src/Modules/V1/Acl/Http/Controllers/UsersController.php 1 patch
Indentation   +197 added lines, -197 removed lines patch added patch discarded remove patch
@@ -7,201 +7,201 @@
 block discarded – undo
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';
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'];
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'];
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
-    'email'    => 'required|email|unique:users,email,{id}',
38
-    'password' => 'min:6'
39
-    ];
40
-
41
-    /**
42
-     * Return the logged in user account.
43
-     * 
44
-     * @return \Illuminate\Http\Response
45
-     */
46
-    public function account()
47
-    {
48
-        $relations = $this->relations && $this->relations['account'] ? $this->relations['account'] : [];
49
-        return \Response::json(\Core::users()->account($relations), 200);
50
-    }
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
-    }
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
-    }
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
-    }
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
-            'email'    => 'required|email|unique:users,email,{id}', 
94
-            'password' => 'required|min:6'
95
-            ]);
96
-
97
-        return \Response::json(\Core::users()->register($request->only('email', 'password')), 200);
98
-    }
99
-
100
-    /**
101
-     * Handle a login request of the none admin to the application.
102
-     *
103
-     * @param  \Illuminate\Http\Request  $request
104
-     * @return \Illuminate\Http\Response
105
-     */
106
-    public function login(Request $request)
107
-    {
108
-        $this->validate($request, [
109
-            'email'    => 'required|email', 
110
-            'password' => 'required|min:6',
111
-            'admin'    => 'boolean'
112
-            ]);
113
-
114
-        return \Response::json(\Core::users()->login($request->only('email', 'password'), $request->get('admin')), 200);
115
-    }
116
-
117
-    /**
118
-     * Handle a social login request of the none admin to the application.
119
-     *
120
-     * @param  \Illuminate\Http\Request  $request
121
-     * @return \Illuminate\Http\Response
122
-     */
123
-    public function loginSocial(Request $request)
124
-    {
125
-        $this->validate($request, [
126
-            'auth_code'    => 'required_without:access_token',
127
-            'access_token' => 'required_without:auth_code',
128
-            'type'         => 'required|in:facebook,google'
129
-            ]);
130
-
131
-        return \Response::json(\Core::users()->loginSocial($request->only('auth_code', 'access_token', 'type')), 200);
132
-    }
133
-
134
-    /**
135
-     * Handle an assign groups to user request.
136
-     *
137
-     * @param  \Illuminate\Http\Request  $request
138
-     * @return \Illuminate\Http\Response
139
-     */
140
-    public function assigngroups(Request $request)
141
-    {
142
-        $this->validate($request, [
143
-            'group_ids' => 'required|exists:groups,id', 
144
-            'user_id'   => 'required|exists:users,id'
145
-            ]);
146
-
147
-        return \Response::json(\Core::users()->assignGroups($request->get('user_id'), $request->get('group_ids')), 200);
148
-    }
149
-
150
-    /**
151
-     * Send a reset link to the given user.
152
-     *
153
-     * @param  \Illuminate\Http\Request  $request
154
-     * @return \Illuminate\Http\Response
155
-     */
156
-    public function sendreset(Request $request)
157
-    {
158
-        $this->validate($request, ['email' => 'required|email', 'url' => 'required|url']);
159
-
160
-        return \Response::json(\Core::users()->sendReset($request->only('email'), $request->get('url')), 200);
161
-    }
162
-
163
-    /**
164
-     * Reset the given user's password.
165
-     *
166
-     * @param  \Illuminate\Http\Request  $request
167
-     * @return \Illuminate\Http\Response
168
-     */
169
-    public function resetpassword(Request $request)
170
-    {
171
-        $this->validate($request, [
172
-            'token'                 => 'required',
173
-            'email'                 => 'required|email',
174
-            'password'              => 'required|confirmed|min:6',
175
-            'password_confirmation' => 'required',
176
-        ]);
177
-
178
-        return \Response::json(\Core::users()->resetPassword($request->only('email', 'password', 'password_confirmation', 'token')), 200);
179
-    }
180
-
181
-    /**
182
-     * Change the logged in user password.
183
-     *
184
-     * @param  \Illuminate\Http\Request  $request
185
-     * @return \Illuminate\Http\Response
186
-     */
187
-    public function changePassword(Request $request)
188
-    {
189
-        $this->validate($request, [
190
-            'old_password'          => 'required',
191
-            'password'              => 'required|confirmed|min:6',
192
-            'password_confirmation' => 'required',
193
-        ]);
194
-
195
-        return \Response::json(\Core::users()->changePassword($request->only('old_password', 'password', 'password_confirmation')), 200);
196
-    }
197
-
198
-    /**
199
-     * Refresh the expired login token.
200
-     *
201
-     * @return \Illuminate\Http\Response
202
-     */
203
-    public function refreshtoken()
204
-    {
205
-        return \Response::json(\Core::users()->refreshtoken(), 200);
206
-    }
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
+
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'];
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'];
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
+	'email'    => 'required|email|unique:users,email,{id}',
38
+	'password' => 'min:6'
39
+	];
40
+
41
+	/**
42
+	 * Return the logged in user account.
43
+	 * 
44
+	 * @return \Illuminate\Http\Response
45
+	 */
46
+	public function account()
47
+	{
48
+		$relations = $this->relations && $this->relations['account'] ? $this->relations['account'] : [];
49
+		return \Response::json(\Core::users()->account($relations), 200);
50
+	}
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
+	}
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
+	}
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
+	}
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
+			'email'    => 'required|email|unique:users,email,{id}', 
94
+			'password' => 'required|min:6'
95
+			]);
96
+
97
+		return \Response::json(\Core::users()->register($request->only('email', 'password')), 200);
98
+	}
99
+
100
+	/**
101
+	 * Handle a login request of the none admin to the application.
102
+	 *
103
+	 * @param  \Illuminate\Http\Request  $request
104
+	 * @return \Illuminate\Http\Response
105
+	 */
106
+	public function login(Request $request)
107
+	{
108
+		$this->validate($request, [
109
+			'email'    => 'required|email', 
110
+			'password' => 'required|min:6',
111
+			'admin'    => 'boolean'
112
+			]);
113
+
114
+		return \Response::json(\Core::users()->login($request->only('email', 'password'), $request->get('admin')), 200);
115
+	}
116
+
117
+	/**
118
+	 * Handle a social login request of the none admin to the application.
119
+	 *
120
+	 * @param  \Illuminate\Http\Request  $request
121
+	 * @return \Illuminate\Http\Response
122
+	 */
123
+	public function loginSocial(Request $request)
124
+	{
125
+		$this->validate($request, [
126
+			'auth_code'    => 'required_without:access_token',
127
+			'access_token' => 'required_without:auth_code',
128
+			'type'         => 'required|in:facebook,google'
129
+			]);
130
+
131
+		return \Response::json(\Core::users()->loginSocial($request->only('auth_code', 'access_token', 'type')), 200);
132
+	}
133
+
134
+	/**
135
+	 * Handle an assign groups to user request.
136
+	 *
137
+	 * @param  \Illuminate\Http\Request  $request
138
+	 * @return \Illuminate\Http\Response
139
+	 */
140
+	public function assigngroups(Request $request)
141
+	{
142
+		$this->validate($request, [
143
+			'group_ids' => 'required|exists:groups,id', 
144
+			'user_id'   => 'required|exists:users,id'
145
+			]);
146
+
147
+		return \Response::json(\Core::users()->assignGroups($request->get('user_id'), $request->get('group_ids')), 200);
148
+	}
149
+
150
+	/**
151
+	 * Send a reset link to the given user.
152
+	 *
153
+	 * @param  \Illuminate\Http\Request  $request
154
+	 * @return \Illuminate\Http\Response
155
+	 */
156
+	public function sendreset(Request $request)
157
+	{
158
+		$this->validate($request, ['email' => 'required|email', 'url' => 'required|url']);
159
+
160
+		return \Response::json(\Core::users()->sendReset($request->only('email'), $request->get('url')), 200);
161
+	}
162
+
163
+	/**
164
+	 * Reset the given user's password.
165
+	 *
166
+	 * @param  \Illuminate\Http\Request  $request
167
+	 * @return \Illuminate\Http\Response
168
+	 */
169
+	public function resetpassword(Request $request)
170
+	{
171
+		$this->validate($request, [
172
+			'token'                 => 'required',
173
+			'email'                 => 'required|email',
174
+			'password'              => 'required|confirmed|min:6',
175
+			'password_confirmation' => 'required',
176
+		]);
177
+
178
+		return \Response::json(\Core::users()->resetPassword($request->only('email', 'password', 'password_confirmation', 'token')), 200);
179
+	}
180
+
181
+	/**
182
+	 * Change the logged in user password.
183
+	 *
184
+	 * @param  \Illuminate\Http\Request  $request
185
+	 * @return \Illuminate\Http\Response
186
+	 */
187
+	public function changePassword(Request $request)
188
+	{
189
+		$this->validate($request, [
190
+			'old_password'          => 'required',
191
+			'password'              => 'required|confirmed|min:6',
192
+			'password_confirmation' => 'required',
193
+		]);
194
+
195
+		return \Response::json(\Core::users()->changePassword($request->only('old_password', 'password', 'password_confirmation')), 200);
196
+	}
197
+
198
+	/**
199
+	 * Refresh the expired login token.
200
+	 *
201
+	 * @return \Illuminate\Http\Response
202
+	 */
203
+	public function refreshtoken()
204
+	{
205
+		return \Response::json(\Core::users()->refreshtoken(), 200);
206
+	}
207 207
 }
Please login to merge, or discard this patch.
src/Modules/V1/Acl/Http/Controllers/GroupsController.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -8,53 +8,53 @@
 block discarded – undo
8 8
 
9 9
 class GroupsController extends BaseApiController
10 10
 {
11
-    /**
12
-     * The name of the model that is used by the base api controller 
13
-     * to preform actions like (add, edit ... etc).
14
-     * @var string
15
-     */
16
-    protected $model               = 'groups';
11
+	/**
12
+	 * The name of the model that is used by the base api controller 
13
+	 * to preform actions like (add, edit ... etc).
14
+	 * @var string
15
+	 */
16
+	protected $model               = 'groups';
17 17
 
18
-    /**
19
-     * The validations rules used by the base api controller
20
-     * to check before add.
21
-     * @var array
22
-     */
23
-    protected $validationRules  = [
24
-    'name' => 'required|string|max:100|unique:groups,name,{id}'
25
-    ];
18
+	/**
19
+	 * The validations rules used by the base api controller
20
+	 * to check before add.
21
+	 * @var array
22
+	 */
23
+	protected $validationRules  = [
24
+	'name' => 'required|string|max:100|unique:groups,name,{id}'
25
+	];
26 26
 
27
-    /**
28
-     * Handle an assign permissions to group request.
29
-     *
30
-     * @param  \Illuminate\Http\Request  $request
31
-     * @return \Illuminate\Http\Response
32
-     */
33
-    public function assignpermissions(Request $request)
34
-    {
35
-        $this->validate($request, [
36
-            'permission_ids' => 'required|exists:permissions,id', 
37
-            'group_id'       => 'required|array|exists:groups,id'
38
-            ]);
27
+	/**
28
+	 * Handle an assign permissions to group request.
29
+	 *
30
+	 * @param  \Illuminate\Http\Request  $request
31
+	 * @return \Illuminate\Http\Response
32
+	 */
33
+	public function assignpermissions(Request $request)
34
+	{
35
+		$this->validate($request, [
36
+			'permission_ids' => 'required|exists:permissions,id', 
37
+			'group_id'       => 'required|array|exists:groups,id'
38
+			]);
39 39
 
40
-        return \Response::json(\Core::groups()->assignPermissions($request->get('group_id'), $request->get('permission_ids')), 200);
41
-    }
40
+		return \Response::json(\Core::groups()->assignPermissions($request->get('group_id'), $request->get('permission_ids')), 200);
41
+	}
42 42
 
43
-     /**
44
-     *  Return the users in the given group in pages.
45
-     * 
46
-     * @param  integer $groupId
47
-     * @param  integer $perPage
48
-     * @param  string  $sortBy
49
-     * @param  boolean $desc
50
-     * @return \Illuminate\Http\Response
51
-     */
52
-    public function users($groupId, $perPage = 15, $sortBy = 'created_at', $desc = 1) 
53
-    {
54
-        if ($this->model) 
55
-        {
56
-            $relations = $this->relations && $this->relations['users'] ? $this->relations['users'] : [];
57
-            return \Response::json(call_user_func_array("\Core::{$this->model}", [])->users($groupId, $perPage, $relations, $sortBy, $desc), 200);
58
-        }
59
-    }
43
+	 /**
44
+	  *  Return the users in the given group in pages.
45
+	  * 
46
+	  * @param  integer $groupId
47
+	  * @param  integer $perPage
48
+	  * @param  string  $sortBy
49
+	  * @param  boolean $desc
50
+	  * @return \Illuminate\Http\Response
51
+	  */
52
+	public function users($groupId, $perPage = 15, $sortBy = 'created_at', $desc = 1) 
53
+	{
54
+		if ($this->model) 
55
+		{
56
+			$relations = $this->relations && $this->relations['users'] ? $this->relations['users'] : [];
57
+			return \Response::json(call_user_func_array("\Core::{$this->model}", [])->users($groupId, $perPage, $relations, $sortBy, $desc), 200);
58
+		}
59
+	}
60 60
 }
Please login to merge, or discard this patch.
src/lang/ar/notifications.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@
 block discarded – undo
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
Please login to merge, or discard this patch.