Completed
Push — master ( 0208a8...03841e )
by Sherif
02:49
created
src/Modules/Notifications/Notification.php 2 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -5,40 +5,40 @@
 block discarded – undo
5 5
 
6 6
 class Notification extends Model{
7 7
 
8
-    use SoftDeletes;
9
-    protected $table    = 'notifications';
10
-    protected $dates    = ['created_at', 'updated_at', 'deleted_at'];
11
-    protected $hidden   = ['deleted_at', 'item_type'];
12
-    protected $guarded  = ['id'];
13
-    protected $fillable = ['name', 'description', 'item_name', 'item_type', 'item_id', 'notified'];
14
-
15
-    public function getCreatedAtAttribute($value)
16
-    {
17
-        return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
18
-    }
19
-
20
-    public function getUpdatedAtAttribute($value)
21
-    {
22
-        return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
23
-    }
24
-
25
-    public function getDeletedAtAttribute($value)
26
-    {
27
-        return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
28
-    }
8
+	use SoftDeletes;
9
+	protected $table    = 'notifications';
10
+	protected $dates    = ['created_at', 'updated_at', 'deleted_at'];
11
+	protected $hidden   = ['deleted_at', 'item_type'];
12
+	protected $guarded  = ['id'];
13
+	protected $fillable = ['name', 'description', 'item_name', 'item_type', 'item_id', 'notified'];
14
+
15
+	public function getCreatedAtAttribute($value)
16
+	{
17
+		return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
18
+	}
19
+
20
+	public function getUpdatedAtAttribute($value)
21
+	{
22
+		return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
23
+	}
24
+
25
+	public function getDeletedAtAttribute($value)
26
+	{
27
+		return \Carbon\Carbon::parse($value)->addHours(\Session::get('timeZoneDiff'))->toDateTimeString();
28
+	}
29 29
     
30
-    public function item()
31
-    {
32
-        return $this->morphTo();
33
-    }
34
-
35
-    public static function boot()
36
-    {
37
-        parent::boot();
38
-
39
-        Notification::created(function($notification)
40
-        {
41
-            \Redis::publish('notification', json_encode($notification->toArray()));
42
-        });
43
-    }
30
+	public function item()
31
+	{
32
+		return $this->morphTo();
33
+	}
34
+
35
+	public static function boot()
36
+	{
37
+		parent::boot();
38
+
39
+		Notification::created(function($notification)
40
+		{
41
+			\Redis::publish('notification', json_encode($notification->toArray()));
42
+		});
43
+	}
44 44
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 use Illuminate\Database\Eloquent\Model;
4 4
 use Illuminate\Database\Eloquent\SoftDeletes;
5 5
 
6
-class Notification extends Model{
6
+class Notification extends Model {
7 7
 
8 8
     use SoftDeletes;
9 9
     protected $table    = 'notifications';
Please login to merge, or discard this patch.
src/Modules/Reporting/Repositories/V1/ReportRepository.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
      *
47 47
      * @param  array   $conditions array of conditions
48 48
      * @param  array   $relations
49
-     * @param  array   $colunmns
49
+     * @param  array   $columns
50 50
      * @return object
51 51
      */
52 52
     public function first($conditions, $relations = [], $columns = array('*'))
Please login to merge, or discard this patch.
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -11,60 +11,60 @@
 block discarded – undo
11 11
 	 */
12 12
 	protected function getModel()
13 13
 	{
14
-        $apiVersion = \Request::header('api-version') ?: 1;
14
+		$apiVersion = \Request::header('api-version') ?: 1;
15 15
 		return 'App\Modules\Reporting\Report';
16 16
 	}
17 17
 
18 18
 	/**
19
-     * Render the given report db view.
20
-     * 
21
-     * @param  integer $id
22
-     * @param  array   $relations
23
-     * @param  array   $columns
24
-     * @return object
25
-     */
26
-    public function find($id, $relations = [], $columns = array('*'))
27
-    {
19
+	 * Render the given report db view.
20
+	 * 
21
+	 * @param  integer $id
22
+	 * @param  array   $relations
23
+	 * @param  array   $columns
24
+	 * @return object
25
+	 */
26
+	public function find($id, $relations = [], $columns = array('*'))
27
+	{
28 28
 		$report = call_user_func_array("{$this->getModel()}::with", array($relations))->find($id, $columns);
29 29
 
30
-        if ( ! \Core::users()->can($report->view_name, 'reports'))
31
-        {
32
-            $error = $this->errorHandler->noPermissions();
33
-            abort($error['status'], $error['message']);
34
-        }
30
+		if ( ! \Core::users()->can($report->view_name, 'reports'))
31
+		{
32
+			$error = $this->errorHandler->noPermissions();
33
+			abort($error['status'], $error['message']);
34
+		}
35 35
 
36 36
 		if ( ! $report) 
37 37
 		{
38 38
 			$error = $this->errorHandler->notFound('report');
39 39
 			abort($error['status'], $error['message']);
40 40
 		}
41
-        return \DB::table($report->view_name)->get();
42
-    }
41
+		return \DB::table($report->view_name)->get();
42
+	}
43 43
 
44
-    /**
45
-     * Render the given report db view based on the given
46
-     * condition.
47
-     *
48
-     * @param  array   $conditions array of conditions
49
-     * @param  array   $relations
50
-     * @param  array   $colunmns
51
-     * @return object
52
-     */
53
-    public function first($conditions, $relations = [], $columns = array('*'))
54
-    {
44
+	/**
45
+	 * Render the given report db view based on the given
46
+	 * condition.
47
+	 *
48
+	 * @param  array   $conditions array of conditions
49
+	 * @param  array   $relations
50
+	 * @param  array   $colunmns
51
+	 * @return object
52
+	 */
53
+	public function first($conditions, $relations = [], $columns = array('*'))
54
+	{
55 55
 		$conditions = $this->constructConditions($conditions);
56 56
 		$report     = call_user_func_array("{$this->getModel()}::with", array($relations))->whereRaw($conditions['conditionString'], $conditions['conditionValues'])->first($columns);
57 57
         
58
-        if ( ! \Core::users()->can($report->view_name, 'reports'))
59
-        {
60
-            $error = $this->errorHandler->noPermissions();
61
-            abort($error['status'], $error['message']);
62
-        }
58
+		if ( ! \Core::users()->can($report->view_name, 'reports'))
59
+		{
60
+			$error = $this->errorHandler->noPermissions();
61
+			abort($error['status'], $error['message']);
62
+		}
63 63
 		if ( ! $report) 
64 64
 		{
65 65
 			$error = $this->errorHandler->notFound('report');
66 66
 			abort($error['status'], $error['message']);
67 67
 		}
68
-        return \DB::table($report->view_name)->get();  
69
-    }
68
+		return \DB::table($report->view_name)->get();  
69
+	}
70 70
 }
Please login to merge, or discard this patch.
src/Modules/Acl/Database/Migrations/2016_01_05_130507_initialize_acl.php 1 patch
Indentation   +188 added lines, -188 removed lines patch added patch discarded remove patch
@@ -12,191 +12,191 @@  discard block
 block discarded – undo
12 12
 	 */
13 13
 	public function up()
14 14
 	{
15
-        /**
16
-         * Delete previous permissions.
17
-         */
15
+		/**
16
+		 * Delete previous permissions.
17
+		 */
18 18
 		DB::table('permissions')->whereIn('model', ['users', 'permissions', 'groups'])->delete();
19 19
 
20 20
 		/**
21
-         * Insert the permissions related to this module.
22
-         */
23
-        DB::table('permissions')->insert(
24
-        	[
25
-        		/**
26
-        		 * Users model permissions.
27
-        		 */
28
-	        	[
29
-	        	'name'       => 'save',
30
-	        	'model'      => 'users',
31
-	        	'created_at' => \DB::raw('NOW()'),
32
-	        	'updated_at' => \DB::raw('NOW()')
33
-	        	],
34
-	        	[
35
-	        	'name'       => 'delete',
36
-	        	'model'      => 'users',
37
-	        	'created_at' => \DB::raw('NOW()'),
38
-	        	'updated_at' => \DB::raw('NOW()')
39
-	        	],
40
-	        	[
41
-	        	'name'       => 'find',
42
-	        	'model'      => 'users',
43
-	        	'created_at' => \DB::raw('NOW()'),
44
-	        	'updated_at' => \DB::raw('NOW()')
45
-	        	],
46
-	        	[
47
-	        	'name'       => 'list',
48
-	        	'model'      => 'users',
49
-	        	'created_at' => \DB::raw('NOW()'),
50
-	        	'updated_at' => \DB::raw('NOW()')
51
-	        	],
52
-	        	[
53
-	        	'name'       => 'search',
54
-	        	'model'      => 'users',
55
-	        	'created_at' => \DB::raw('NOW()'),
56
-	        	'updated_at' => \DB::raw('NOW()')
57
-	        	],
58
-	        	[
59
-	        	'name'       => 'findby',
60
-	        	'model'      => 'users',
61
-	        	'created_at' => \DB::raw('NOW()'),
62
-	        	'updated_at' => \DB::raw('NOW()')
63
-	        	],
64
-	        	[
65
-	        	'name'       => 'first',
66
-	        	'model'      => 'users',
67
-	        	'created_at' => \DB::raw('NOW()'),
68
-	        	'updated_at' => \DB::raw('NOW()')
69
-	        	],
70
-	        	[
71
-	        	'name'       => 'paginate',
72
-	        	'model'      => 'users',
73
-	        	'created_at' => \DB::raw('NOW()'),
74
-	        	'updated_at' => \DB::raw('NOW()')
75
-	        	],
76
-	        	[
77
-	        	'name'       => 'paginateby',
78
-	        	'model'      => 'users',
79
-	        	'created_at' => \DB::raw('NOW()'),
80
-	        	'updated_at' => \DB::raw('NOW()')
81
-	        	],
82
-	        	[
83
-	        	'name'       => 'assigngroup',
84
-	        	'model'      => 'users',
85
-	        	'created_at' => \DB::raw('NOW()'),
86
-	        	'updated_at' => \DB::raw('NOW()')
87
-	        	],
21
+		 * Insert the permissions related to this module.
22
+		 */
23
+		DB::table('permissions')->insert(
24
+			[
25
+				/**
26
+				 * Users model permissions.
27
+				 */
28
+				[
29
+				'name'       => 'save',
30
+				'model'      => 'users',
31
+				'created_at' => \DB::raw('NOW()'),
32
+				'updated_at' => \DB::raw('NOW()')
33
+				],
34
+				[
35
+				'name'       => 'delete',
36
+				'model'      => 'users',
37
+				'created_at' => \DB::raw('NOW()'),
38
+				'updated_at' => \DB::raw('NOW()')
39
+				],
40
+				[
41
+				'name'       => 'find',
42
+				'model'      => 'users',
43
+				'created_at' => \DB::raw('NOW()'),
44
+				'updated_at' => \DB::raw('NOW()')
45
+				],
46
+				[
47
+				'name'       => 'list',
48
+				'model'      => 'users',
49
+				'created_at' => \DB::raw('NOW()'),
50
+				'updated_at' => \DB::raw('NOW()')
51
+				],
52
+				[
53
+				'name'       => 'search',
54
+				'model'      => 'users',
55
+				'created_at' => \DB::raw('NOW()'),
56
+				'updated_at' => \DB::raw('NOW()')
57
+				],
58
+				[
59
+				'name'       => 'findby',
60
+				'model'      => 'users',
61
+				'created_at' => \DB::raw('NOW()'),
62
+				'updated_at' => \DB::raw('NOW()')
63
+				],
64
+				[
65
+				'name'       => 'first',
66
+				'model'      => 'users',
67
+				'created_at' => \DB::raw('NOW()'),
68
+				'updated_at' => \DB::raw('NOW()')
69
+				],
70
+				[
71
+				'name'       => 'paginate',
72
+				'model'      => 'users',
73
+				'created_at' => \DB::raw('NOW()'),
74
+				'updated_at' => \DB::raw('NOW()')
75
+				],
76
+				[
77
+				'name'       => 'paginateby',
78
+				'model'      => 'users',
79
+				'created_at' => \DB::raw('NOW()'),
80
+				'updated_at' => \DB::raw('NOW()')
81
+				],
82
+				[
83
+				'name'       => 'assigngroup',
84
+				'model'      => 'users',
85
+				'created_at' => \DB::raw('NOW()'),
86
+				'updated_at' => \DB::raw('NOW()')
87
+				],
88 88
 
89
-	        	/**
90
-        		 * Permissions model permissions.
91
-        		 */
92
-        		[
93
-	        	'name'       => 'find',
94
-	        	'model'      => 'permissions',
95
-	        	'created_at' => \DB::raw('NOW()'),
96
-	        	'updated_at' => \DB::raw('NOW()')
97
-	        	],
98
-	        	[
99
-	        	'name'       => 'search',
100
-	        	'model'      => 'permissions',
101
-	        	'created_at' => \DB::raw('NOW()'),
102
-	        	'updated_at' => \DB::raw('NOW()')
103
-	        	],
104
-	        	[
105
-	        	'name'       => 'list',
106
-	        	'model'      => 'permissions',
107
-	        	'created_at' => \DB::raw('NOW()'),
108
-	        	'updated_at' => \DB::raw('NOW()')
109
-	        	],
110
-	        	[
111
-	        	'name'       => 'findby',
112
-	        	'model'      => 'permissions',
113
-	        	'created_at' => \DB::raw('NOW()'),
114
-	        	'updated_at' => \DB::raw('NOW()')
115
-	        	],
116
-	        	[
117
-	        	'name'       => 'first',
118
-	        	'model'      => 'permissions',
119
-	        	'created_at' => \DB::raw('NOW()'),
120
-	        	'updated_at' => \DB::raw('NOW()')
121
-	        	],
122
-	        	[
123
-	        	'name'       => 'paginate',
124
-	        	'model'      => 'permissions',
125
-	        	'created_at' => \DB::raw('NOW()'),
126
-	        	'updated_at' => \DB::raw('NOW()')
127
-	        	],
128
-	        	[
129
-	        	'name'       => 'paginateby',
130
-	        	'model'      => 'permissions',
131
-	        	'created_at' => \DB::raw('NOW()'),
132
-	        	'updated_at' => \DB::raw('NOW()')
133
-	        	],
89
+				/**
90
+				 * Permissions model permissions.
91
+				 */
92
+				[
93
+				'name'       => 'find',
94
+				'model'      => 'permissions',
95
+				'created_at' => \DB::raw('NOW()'),
96
+				'updated_at' => \DB::raw('NOW()')
97
+				],
98
+				[
99
+				'name'       => 'search',
100
+				'model'      => 'permissions',
101
+				'created_at' => \DB::raw('NOW()'),
102
+				'updated_at' => \DB::raw('NOW()')
103
+				],
104
+				[
105
+				'name'       => 'list',
106
+				'model'      => 'permissions',
107
+				'created_at' => \DB::raw('NOW()'),
108
+				'updated_at' => \DB::raw('NOW()')
109
+				],
110
+				[
111
+				'name'       => 'findby',
112
+				'model'      => 'permissions',
113
+				'created_at' => \DB::raw('NOW()'),
114
+				'updated_at' => \DB::raw('NOW()')
115
+				],
116
+				[
117
+				'name'       => 'first',
118
+				'model'      => 'permissions',
119
+				'created_at' => \DB::raw('NOW()'),
120
+				'updated_at' => \DB::raw('NOW()')
121
+				],
122
+				[
123
+				'name'       => 'paginate',
124
+				'model'      => 'permissions',
125
+				'created_at' => \DB::raw('NOW()'),
126
+				'updated_at' => \DB::raw('NOW()')
127
+				],
128
+				[
129
+				'name'       => 'paginateby',
130
+				'model'      => 'permissions',
131
+				'created_at' => \DB::raw('NOW()'),
132
+				'updated_at' => \DB::raw('NOW()')
133
+				],
134 134
 
135
-	        	/**
136
-        		 * Groups model permissions.
137
-        		 */
138
-	        	[
139
-	        	'name'       => 'save',
140
-	        	'model'      => 'groups',
141
-	        	'created_at' => \DB::raw('NOW()'),
142
-	        	'updated_at' => \DB::raw('NOW()')
143
-	        	],
144
-	        	[
145
-	        	'name'       => 'delete',
146
-	        	'model'      => 'groups',
147
-	        	'created_at' => \DB::raw('NOW()'),
148
-	        	'updated_at' => \DB::raw('NOW()')
149
-	        	],
150
-	        	[
151
-	        	'name'       => 'find',
152
-	        	'model'      => 'groups',
153
-	        	'created_at' => \DB::raw('NOW()'),
154
-	        	'updated_at' => \DB::raw('NOW()')
155
-	        	],
156
-	        	[
157
-	        	'name'       => 'search',
158
-	        	'model'      => 'groups',
159
-	        	'created_at' => \DB::raw('NOW()'),
160
-	        	'updated_at' => \DB::raw('NOW()')
161
-	        	],
162
-	        	[
163
-	        	'name'       => 'list',
164
-	        	'model'      => 'groups',
165
-	        	'created_at' => \DB::raw('NOW()'),
166
-	        	'updated_at' => \DB::raw('NOW()')
167
-	        	],
168
-	        	[
169
-	        	'name'       => 'findby',
170
-	        	'model'      => 'groups',
171
-	        	'created_at' => \DB::raw('NOW()'),
172
-	        	'updated_at' => \DB::raw('NOW()')
173
-	        	],
174
-	        	[
175
-	        	'name'       => 'first',
176
-	        	'model'      => 'groups',
177
-	        	'created_at' => \DB::raw('NOW()'),
178
-	        	'updated_at' => \DB::raw('NOW()')
179
-	        	],
180
-	        	[
181
-	        	'name'       => 'paginate',
182
-	        	'model'      => 'groups',
183
-	        	'created_at' => \DB::raw('NOW()'),
184
-	        	'updated_at' => \DB::raw('NOW()')
185
-	        	],
186
-	        	[
187
-	        	'name'       => 'paginateby',
188
-	        	'model'      => 'groups',
189
-	        	'created_at' => \DB::raw('NOW()'),
190
-	        	'updated_at' => \DB::raw('NOW()')
191
-	        	],
192
-	        	[
193
-	        	'name'       => 'assignpermissions',
194
-	        	'model'      => 'groups',
195
-	        	'created_at' => \DB::raw('NOW()'),
196
-	        	'updated_at' => \DB::raw('NOW()')
197
-	        	],
198
-        	]
199
-        );
135
+				/**
136
+				 * Groups model permissions.
137
+				 */
138
+				[
139
+				'name'       => 'save',
140
+				'model'      => 'groups',
141
+				'created_at' => \DB::raw('NOW()'),
142
+				'updated_at' => \DB::raw('NOW()')
143
+				],
144
+				[
145
+				'name'       => 'delete',
146
+				'model'      => 'groups',
147
+				'created_at' => \DB::raw('NOW()'),
148
+				'updated_at' => \DB::raw('NOW()')
149
+				],
150
+				[
151
+				'name'       => 'find',
152
+				'model'      => 'groups',
153
+				'created_at' => \DB::raw('NOW()'),
154
+				'updated_at' => \DB::raw('NOW()')
155
+				],
156
+				[
157
+				'name'       => 'search',
158
+				'model'      => 'groups',
159
+				'created_at' => \DB::raw('NOW()'),
160
+				'updated_at' => \DB::raw('NOW()')
161
+				],
162
+				[
163
+				'name'       => 'list',
164
+				'model'      => 'groups',
165
+				'created_at' => \DB::raw('NOW()'),
166
+				'updated_at' => \DB::raw('NOW()')
167
+				],
168
+				[
169
+				'name'       => 'findby',
170
+				'model'      => 'groups',
171
+				'created_at' => \DB::raw('NOW()'),
172
+				'updated_at' => \DB::raw('NOW()')
173
+				],
174
+				[
175
+				'name'       => 'first',
176
+				'model'      => 'groups',
177
+				'created_at' => \DB::raw('NOW()'),
178
+				'updated_at' => \DB::raw('NOW()')
179
+				],
180
+				[
181
+				'name'       => 'paginate',
182
+				'model'      => 'groups',
183
+				'created_at' => \DB::raw('NOW()'),
184
+				'updated_at' => \DB::raw('NOW()')
185
+				],
186
+				[
187
+				'name'       => 'paginateby',
188
+				'model'      => 'groups',
189
+				'created_at' => \DB::raw('NOW()'),
190
+				'updated_at' => \DB::raw('NOW()')
191
+				],
192
+				[
193
+				'name'       => 'assignpermissions',
194
+				'model'      => 'groups',
195
+				'created_at' => \DB::raw('NOW()'),
196
+				'updated_at' => \DB::raw('NOW()')
197
+				],
198
+			]
199
+		);
200 200
 
201 201
 		/**
202 202
 		 * Delete previous data.
@@ -222,29 +222,29 @@  discard block
 block discarded – undo
222 222
 		 * Create Default users.
223 223
 		 */
224 224
 		$adminUserId = DB::table('users')->insertGetId(
225
-            [
225
+			[
226 226
 			'email'      => '[email protected]',
227 227
 			'password'   => bcrypt('123456'),
228 228
 			'created_at' => \DB::raw('NOW()'),
229 229
 			'updated_at' => \DB::raw('NOW()')
230 230
 			]
231
-        );
231
+		);
232 232
 
233 233
 		/**
234 234
 		 * Assign users to groups.
235 235
 		 */
236 236
 		DB::table('users_groups')->insert(
237
-        	[
238
-	            [
237
+			[
238
+				[
239 239
 				'user_id'    => $adminUserId,
240 240
 				'group_id'   => $adminGroupId,
241 241
 				'created_at' => \DB::raw('NOW()'),
242 242
 				'updated_at' => \DB::raw('NOW()')
243
-	            ]
244
-        	]
245
-        );
243
+				]
244
+			]
245
+		);
246 246
 
247
-        /**
247
+		/**
248 248
 		 * Assign the permissions to the admin group.
249 249
 		 */
250 250
 		$permissionIds = DB::table('permissions')->whereIn('model', ['users', 'permissions', 'groups'])->select('id')->lists('id');
Please login to merge, or discard this patch.
src/Modules/Acl/Repositories/V1/UserRepository.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,6 +61,6 @@
 block discarded – undo
61 61
 			$user->groups()->attach($group_ids);
62 62
 		});
63 63
 
64
-        return \Core::users()->find($user_id);
64
+		return \Core::users()->find($user_id);
65 65
 	}
66 66
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
 	 * @param  boolean $user
24 24
 	 * @return boolean
25 25
 	 */
26
-	public function can($nameOfPermission, $model, $user = false )
26
+	public function can($nameOfPermission, $model, $user = false)
27 27
 	{		
28 28
 		$user        = $user ?: \Auth::user();
29 29
 		$permissions = [];
30
-		\Core::users()->find($user->id, ['groups.permissions'])->groups->lists('permissions')->each(function ($permission) use (&$permissions, $model){
30
+		\Core::users()->find($user->id, ['groups.permissions'])->groups->lists('permissions')->each(function($permission) use (&$permissions, $model){
31 31
 			$permissions = array_merge($permissions, $permission->where('model', $model)->lists('name')->toArray()); 
32 32
 		});
33 33
 		
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function assignGroups($user_id, $group_ids)
57 57
 	{
58
-		\DB::transaction(function () use ($user_id, $group_ids) {
58
+		\DB::transaction(function() use ($user_id, $group_ids) {
59 59
 			$user = \Core::users()->find($user_id);
60 60
 			$user->groups()->detach();
61 61
 			$user->groups()->attach($group_ids);
Please login to merge, or discard this patch.
src/Modules/Acl/Repositories/V1/GroupRepository.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,6 +29,6 @@
 block discarded – undo
29 29
 			$group->permissions()->attach($permission_ids);
30 30
 		});
31 31
 
32
-        return \Core::groups()->find($group_id);
32
+		return \Core::groups()->find($group_id);
33 33
 	}
34 34
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 	 */
24 24
 	public function assignPermissions($group_id, $permission_ids)
25 25
 	{
26
-		\DB::transaction(function () use ($group_id, $permission_ids) {
26
+		\DB::transaction(function() use ($group_id, $permission_ids) {
27 27
 			$group = \Core::groups()->find($group_id);
28 28
 			$group->permissions()->detach();
29 29
 			$group->permissions()->attach($permission_ids);
Please login to merge, or discard this patch.
src/Modules/Acl/Http/routes.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@
 block discarded – undo
15 15
 
16 16
 	$apiVersion = \Request::header('api-version') ?: 1;
17 17
 	Route::controllers([
18
-		'users'       => class_exists('V' . $apiVersion . '\UsersController') ? 'V' . $apiVersion . '\UsersController' : 'V1\UsersController',
19
-		'groups'      => 'V' . $apiVersion . '\GroupsController',
20
-		'permissions' => 'V' . $apiVersion . '\PermissionsController'
18
+		'users'       => class_exists('V'.$apiVersion.'\UsersController') ? 'V'.$apiVersion.'\UsersController' : 'V1\UsersController',
19
+		'groups'      => 'V'.$apiVersion.'\GroupsController',
20
+		'permissions' => 'V'.$apiVersion.'\PermissionsController'
21 21
 		]);
22 22
 });
23 23
\ No newline at end of file
Please login to merge, or discard this patch.
src/Modules/Acl/Http/Controllers/V1/GroupsController.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -8,35 +8,35 @@
 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 postAssignpermissions(Request $request)
34
-    {
35
-        $this->validate($request, [
36
-            'permission_ids' => 'required|exists:permissions,id', 
37
-            'group_id'       => 'required|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 postAssignpermissions(Request $request)
34
+	{
35
+		$this->validate($request, [
36
+			'permission_ids' => 'required|exists:permissions,id', 
37
+			'group_id'       => 'required|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
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,14 +13,14 @@
 block discarded – undo
13 13
      * to preform actions like (add, edit ... etc).
14 14
      * @var string
15 15
      */
16
-    protected $model               = 'groups';
16
+    protected $model = 'groups';
17 17
 
18 18
     /**
19 19
      * The validations rules used by the base api controller
20 20
      * to check before add.
21 21
      * @var array
22 22
      */
23
-    protected $validationRules  = [
23
+    protected $validationRules = [
24 24
     'name' => 'required|string|max:100|unique:groups,name,{id}'
25 25
     ];
26 26
 
Please login to merge, or discard this patch.
src/Modules/Acl/Http/Controllers/V1/UsersController.php 3 patches
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -7,104 +7,104 @@
 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';
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'];
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'];
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', 'register'];
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', 'register'];
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
-    'email'    => 'required|email|unique:users,email,{id}',
38
-    'password' => 'min:6'
39
-    ];
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 40
 
41
-    /**
42
-     * Return the logged in user account.
43
-     * 
44
-     * @return object
45
-     */
46
-    public function getAccount()
47
-    {
48
-       $relations = $this->relations && $this->relations['find'] ? $this->relations['find'] : [];
49
-       return \Response::json(call_user_func_array("\Core::{$this->model}", [])->find(\Auth::id(), $relations), 200);
50
-    }
41
+	/**
42
+	 * Return the logged in user account.
43
+	 * 
44
+	 * @return object
45
+	 */
46
+	public function getAccount()
47
+	{
48
+	   $relations = $this->relations && $this->relations['find'] ? $this->relations['find'] : [];
49
+	   return \Response::json(call_user_func_array("\Core::{$this->model}", [])->find(\Auth::id(), $relations), 200);
50
+	}
51 51
 
52
-    /**
53
-     * Logout the user.
54
-     * 
55
-     * @return void
56
-     */
57
-    public function getLogout()
58
-    {
59
-        return \Response::json(\Auth::logout(), 200);
60
-    }
52
+	/**
53
+	 * Logout the user.
54
+	 * 
55
+	 * @return void
56
+	 */
57
+	public function getLogout()
58
+	{
59
+		return \Response::json(\Auth::logout(), 200);
60
+	}
61 61
 
62
-    /**
63
-     * Handle a registration request.
64
-     *
65
-     * @param  \Illuminate\Http\Request  $request
66
-     * @return \Illuminate\Http\Response
67
-     */
68
-    public function postRegister(Request $request)
69
-    {
70
-        $this->validate($request, ['email' => 'required|email|unique:users,email,{id}','password' => 'required|min:6']);
62
+	/**
63
+	 * Handle a registration request.
64
+	 *
65
+	 * @param  \Illuminate\Http\Request  $request
66
+	 * @return \Illuminate\Http\Response
67
+	 */
68
+	public function postRegister(Request $request)
69
+	{
70
+		$this->validate($request, ['email' => 'required|email|unique:users,email,{id}','password' => 'required|min:6']);
71 71
 
72
-        return \Response::json(\Auth::loginUsingId(\Core::users()->create($request->all())->id), 200);
73
-    }
72
+		return \Response::json(\Auth::loginUsingId(\Core::users()->create($request->all())->id), 200);
73
+	}
74 74
 
75
-    /**
76
-     * Handle a login request to the application.
77
-     *
78
-     * @param  \Illuminate\Http\Request  $request
79
-     * @return \Illuminate\Http\Response
80
-     */
81
-    public function postLogin(Request $request)
82
-    {
83
-        if (\Auth::attempt($request->all())) 
84
-        {
85
-            $relations = $this->relations && $this->relations['find'] ? $this->relations['find'] : [];
86
-            return \Response::json(call_user_func_array("\Core::{$this->model}", [])->find(\Auth::id(), $relations), 200);
87
-        }
88
-        else
89
-        {
90
-            $error = $this->errorHandler->loginFailed();
91
-            abort($error['status'], $error['message']);
92
-        }
93
-    }
75
+	/**
76
+	 * Handle a login request to the application.
77
+	 *
78
+	 * @param  \Illuminate\Http\Request  $request
79
+	 * @return \Illuminate\Http\Response
80
+	 */
81
+	public function postLogin(Request $request)
82
+	{
83
+		if (\Auth::attempt($request->all())) 
84
+		{
85
+			$relations = $this->relations && $this->relations['find'] ? $this->relations['find'] : [];
86
+			return \Response::json(call_user_func_array("\Core::{$this->model}", [])->find(\Auth::id(), $relations), 200);
87
+		}
88
+		else
89
+		{
90
+			$error = $this->errorHandler->loginFailed();
91
+			abort($error['status'], $error['message']);
92
+		}
93
+	}
94 94
 
95
-    /**
96
-     * Handle an assign groups to user request.
97
-     *
98
-     * @param  \Illuminate\Http\Request  $request
99
-     * @return \Illuminate\Http\Response
100
-     */
101
-    public function postAssigngroups(Request $request)
102
-    {
103
-        $this->validate($request, [
104
-            'group_ids' => 'required|exists:groups,id', 
105
-            'user_id'   => 'required|exists:users,id'
106
-            ]);
95
+	/**
96
+	 * Handle an assign groups to user request.
97
+	 *
98
+	 * @param  \Illuminate\Http\Request  $request
99
+	 * @return \Illuminate\Http\Response
100
+	 */
101
+	public function postAssigngroups(Request $request)
102
+	{
103
+		$this->validate($request, [
104
+			'group_ids' => 'required|exists:groups,id', 
105
+			'user_id'   => 'required|exists:users,id'
106
+			]);
107 107
 
108
-        return \Response::json(\Core::users()->assignGroups($request->get('user_id'), $request->get('group_ids')), 200);
109
-    }
108
+		return \Response::json(\Core::users()->assignGroups($request->get('user_id'), $request->get('group_ids')), 200);
109
+	}
110 110
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
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
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * to check before add.
34 34
      * @var array
35 35
      */
36
-    protected $validationRules  = [
36
+    protected $validationRules = [
37 37
     'email'    => 'required|email|unique:users,email,{id}',
38 38
     'password' => 'min:6'
39 39
     ];
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      */
68 68
     public function postRegister(Request $request)
69 69
     {
70
-        $this->validate($request, ['email' => 'required|email|unique:users,email,{id}','password' => 'required|min:6']);
70
+        $this->validate($request, ['email' => 'required|email|unique:users,email,{id}', 'password' => 'required|min:6']);
71 71
 
72 72
         return \Response::json(\Auth::loginUsingId(\Core::users()->create($request->all())->id), 200);
73 73
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -84,8 +84,7 @@
 block discarded – undo
84 84
         {
85 85
             $relations = $this->relations && $this->relations['find'] ? $this->relations['find'] : [];
86 86
             return \Response::json(call_user_func_array("\Core::{$this->model}", [])->find(\Auth::id(), $relations), 200);
87
-        }
88
-        else
87
+        } else
89 88
         {
90 89
             $error = $this->errorHandler->loginFailed();
91 90
             abort($error['status'], $error['message']);
Please login to merge, or discard this patch.
src/Modules/Acl/Http/Controllers/V1/PermissionsController.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@
 block discarded – undo
7 7
 
8 8
 class PermissionsController 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 = 'permissions';
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 = 'permissions';
16 16
 }
Please login to merge, or discard this patch.