Completed
Push — master ( 2d22de...e2d103 )
by Sherif
02:14
created
src/Modules/Acl/Http/Resources/AclUser.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -9,28 +9,28 @@
 block discarded – undo
9 9
 
10 10
 class AclUser extends JsonResource
11 11
 {
12
-    /**
13
-     * Transform the resource into an array.
14
-     *
15
-     * @param  \Illuminate\Http\Request  $request
16
-     * @return array
17
-     */
18
-    public function toArray($request)
19
-    {
20
-        return [
21
-            'id' => $this->id,
22
-            'name' => $this->name,
23
-            'email' => $this->email,
24
-            'profilePicture' => $this->profile_picture,
25
-            'notifications' => NotificationResource::collection($this->whenLoaded('notifications')),
26
-            'readNotifications' => NotificationResource::collection($this->whenLoaded('readNotifications')),
27
-            'unreadNotifications' => NotificationResource::collection($this->whenLoaded('unreadNotifications')),
28
-            'groups' => AclGroupResource::collection($this->whenLoaded('groups')),
29
-            'oauthClients' => OauthClientResource::collection($this->whenLoaded('oauthClients')),
30
-            'locale' => $this->locale,
31
-            'timeZone' => $this->time_zone,
32
-            'createdAt' => $this->created_at,
33
-            'updatedAt' => $this->updated_at,
34
-        ];
35
-    }
12
+	/**
13
+	 * Transform the resource into an array.
14
+	 *
15
+	 * @param  \Illuminate\Http\Request  $request
16
+	 * @return array
17
+	 */
18
+	public function toArray($request)
19
+	{
20
+		return [
21
+			'id' => $this->id,
22
+			'name' => $this->name,
23
+			'email' => $this->email,
24
+			'profilePicture' => $this->profile_picture,
25
+			'notifications' => NotificationResource::collection($this->whenLoaded('notifications')),
26
+			'readNotifications' => NotificationResource::collection($this->whenLoaded('readNotifications')),
27
+			'unreadNotifications' => NotificationResource::collection($this->whenLoaded('unreadNotifications')),
28
+			'groups' => AclGroupResource::collection($this->whenLoaded('groups')),
29
+			'oauthClients' => OauthClientResource::collection($this->whenLoaded('oauthClients')),
30
+			'locale' => $this->locale,
31
+			'timeZone' => $this->time_zone,
32
+			'createdAt' => $this->created_at,
33
+			'updatedAt' => $this->updated_at,
34
+		];
35
+	}
36 36
 }
Please login to merge, or discard this patch.
src/Modules/Acl/Http/Resources/AclGroup.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -8,21 +8,21 @@
 block discarded – undo
8 8
 
9 9
 class AclGroup extends JsonResource
10 10
 {
11
-    /**
12
-     * Transform the resource into an array.
13
-     *
14
-     * @param  \Illuminate\Http\Request  $request
15
-     * @return array
16
-     */
17
-    public function toArray($request)
18
-    {
19
-        return [
20
-            'id' => $this->id,
21
-            'name' => $this->name,
22
-            'users' => UserResource::collection($this->whenLoaded('users')),
23
-            'permissions' => PermissionResource::collection($this->whenLoaded('permissions')),
24
-            'createdAt' => $this->created_at,
25
-            'updatedAt' => $this->updated_at,
26
-        ];
27
-    }
11
+	/**
12
+	 * Transform the resource into an array.
13
+	 *
14
+	 * @param  \Illuminate\Http\Request  $request
15
+	 * @return array
16
+	 */
17
+	public function toArray($request)
18
+	{
19
+		return [
20
+			'id' => $this->id,
21
+			'name' => $this->name,
22
+			'users' => UserResource::collection($this->whenLoaded('users')),
23
+			'permissions' => PermissionResource::collection($this->whenLoaded('permissions')),
24
+			'createdAt' => $this->created_at,
25
+			'updatedAt' => $this->updated_at,
26
+		];
27
+	}
28 28
 }
Please login to merge, or discard this patch.
src/Modules/Acl/Http/Controllers/GroupsController.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -9,40 +9,40 @@
 block discarded – undo
9 9
 
10 10
 class GroupsController extends BaseApiController
11 11
 {
12
-    /**
13
-     * The validations rules used by the base api controller
14
-     * to check before add.
15
-     * @var array
16
-     */
17
-    protected $validationRules = [
18
-    'name' => 'required|string|max:100|unique:groups,name,{id}'
19
-    ];
12
+	/**
13
+	 * The validations rules used by the base api controller
14
+	 * to check before add.
15
+	 * @var array
16
+	 */
17
+	protected $validationRules = [
18
+	'name' => 'required|string|max:100|unique:groups,name,{id}'
19
+	];
20 20
 
21
-    /**
22
-     * Init new object.
23
-     *
24
-     * @param   GroupRepository $repo
25
-     * @param   CoreConfig      $config
26
-     * @return  void
27
-     */
28
-    public function __construct(GroupRepository $repo, CoreConfig $config)
29
-    {
30
-        parent::__construct($repo, $config, 'App\Modules\Acl\Http\Resources\AclGroup');
31
-    }
21
+	/**
22
+	 * Init new object.
23
+	 *
24
+	 * @param   GroupRepository $repo
25
+	 * @param   CoreConfig      $config
26
+	 * @return  void
27
+	 */
28
+	public function __construct(GroupRepository $repo, CoreConfig $config)
29
+	{
30
+		parent::__construct($repo, $config, 'App\Modules\Acl\Http\Resources\AclGroup');
31
+	}
32 32
 
33
-    /**
34
-     * Handle an assign permissions to group request.
35
-     *
36
-     * @param  \Illuminate\Http\Request  $request
37
-     * @return \Illuminate\Http\Response
38
-     */
39
-    public function assignpermissions(Request $request)
40
-    {
41
-        $this->validate($request, [
42
-            'permission_ids' => 'required|exists:permissions,id',
43
-            'group_id'       => 'required|array|exists:groups,id'
44
-            ]);
33
+	/**
34
+	 * Handle an assign permissions to group request.
35
+	 *
36
+	 * @param  \Illuminate\Http\Request  $request
37
+	 * @return \Illuminate\Http\Response
38
+	 */
39
+	public function assignpermissions(Request $request)
40
+	{
41
+		$this->validate($request, [
42
+			'permission_ids' => 'required|exists:permissions,id',
43
+			'group_id'       => 'required|array|exists:groups,id'
44
+			]);
45 45
 
46
-        return new $this->modelResource($this->repo->assignPermissions($request->get('group_id'), $request->get('permission_ids')));
47
-    }
46
+		return new $this->modelResource($this->repo->assignPermissions($request->get('group_id'), $request->get('permission_ids')));
47
+	}
48 48
 }
Please login to merge, or discard this patch.
src/Modules/Acl/Http/Controllers/PermissionsController.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -8,15 +8,15 @@
 block discarded – undo
8 8
 
9 9
 class PermissionsController extends BaseApiController
10 10
 {
11
-    /**
12
-     * Init new object.
13
-     *
14
-     * @param   PermissionRepository $repo
15
-     * @param   CoreConfig           $config
16
-     * @return  void
17
-     */
18
-    public function __construct(PermissionRepository $repo, CoreConfig $config)
19
-    {
20
-        parent::__construct($repo, $config, 'App\Modules\Acl\Http\Resources\AclPermission');
21
-    }
11
+	/**
12
+	 * Init new object.
13
+	 *
14
+	 * @param   PermissionRepository $repo
15
+	 * @param   CoreConfig           $config
16
+	 * @return  void
17
+	 */
18
+	public function __construct(PermissionRepository $repo, CoreConfig $config)
19
+	{
20
+		parent::__construct($repo, $config, 'App\Modules\Acl\Http\Resources\AclPermission');
21
+	}
22 22
 }
Please login to merge, or discard this patch.
src/Modules/Acl/Http/Controllers/OauthClientsController.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -9,49 +9,49 @@
 block discarded – undo
9 9
 
10 10
 class OauthClientsController extends BaseApiController
11 11
 {
12
-    /**
13
-     * The validations rules used by the base api controller
14
-     * to check before add.
15
-     * @var array
16
-     */
17
-    protected $validationRules = [
18
-        'name'     => 'required|max:255',
19
-        'redirect' => 'required|url',
20
-        'user_id'  => 'required|exists:users,id',
21
-        'revoked'  => 'boolean'
22
-    ];
12
+	/**
13
+	 * The validations rules used by the base api controller
14
+	 * to check before add.
15
+	 * @var array
16
+	 */
17
+	protected $validationRules = [
18
+		'name'     => 'required|max:255',
19
+		'redirect' => 'required|url',
20
+		'user_id'  => 'required|exists:users,id',
21
+		'revoked'  => 'boolean'
22
+	];
23 23
 
24
-    /**
25
-     * Init new object.
26
-     *
27
-     * @param   OauthClientRepository $repo
28
-     * @param   CoreConfig            $config
29
-     * @return  void
30
-     */
31
-    public function __construct(OauthClientRepository $repo, CoreConfig $config)
32
-    {
33
-        parent::__construct($repo, $config, 'App\Modules\Acl\Http\Resources\OauthClient');
34
-    }
24
+	/**
25
+	 * Init new object.
26
+	 *
27
+	 * @param   OauthClientRepository $repo
28
+	 * @param   CoreConfig            $config
29
+	 * @return  void
30
+	 */
31
+	public function __construct(OauthClientRepository $repo, CoreConfig $config)
32
+	{
33
+		parent::__construct($repo, $config, 'App\Modules\Acl\Http\Resources\OauthClient');
34
+	}
35 35
 
36
-    /**
37
-     * Revoke the given client.
38
-     *
39
-     * @param  integer  $clientId Id of the client
40
-     * @return \Illuminate\Http\Response
41
-     */
42
-    public function revoke($clientId)
43
-    {
44
-        return new GeneralResource($this->repo->revoke($clientId));
45
-    }
36
+	/**
37
+	 * Revoke the given client.
38
+	 *
39
+	 * @param  integer  $clientId Id of the client
40
+	 * @return \Illuminate\Http\Response
41
+	 */
42
+	public function revoke($clientId)
43
+	{
44
+		return new GeneralResource($this->repo->revoke($clientId));
45
+	}
46 46
 
47
-    /**
48
-     * Un revoke the given client.
49
-     *
50
-     * @param  integer  $clientId Id of the client
51
-     * @return \Illuminate\Http\Response
52
-     */
53
-    public function unRevoke($clientId)
54
-    {
55
-        return new GeneralResource($this->repo->unRevoke($clientId));
56
-    }
47
+	/**
48
+	 * Un revoke the given client.
49
+	 *
50
+	 * @param  integer  $clientId Id of the client
51
+	 * @return \Illuminate\Http\Response
52
+	 */
53
+	public function unRevoke($clientId)
54
+	{
55
+		return new GeneralResource($this->repo->unRevoke($clientId));
56
+	}
57 57
 }
Please login to merge, or discard this patch.
src/Modules/Acl/Proxy/LoginProxy.php 1 patch
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -2,77 +2,77 @@
 block discarded – undo
2 2
 
3 3
 class LoginProxy
4 4
 {
5
-    /**
6
-     * Attempt to create an access token using user credentials.
7
-     *
8
-     * @param  array   $credentials
9
-     * @param  boolean $adminLogin
10
-     * @return array
11
-     */
12
-    public function login($credentials, $adminLogin = false)
13
-    {
14
-        $user = \Core::users()->login($credentials, $adminLogin);
15
-        $tokens = $this->proxy('password', [
16
-            'username' => $credentials['email'],
17
-            'password' => $credentials['password']
18
-        ]);
5
+	/**
6
+	 * Attempt to create an access token using user credentials.
7
+	 *
8
+	 * @param  array   $credentials
9
+	 * @param  boolean $adminLogin
10
+	 * @return array
11
+	 */
12
+	public function login($credentials, $adminLogin = false)
13
+	{
14
+		$user = \Core::users()->login($credentials, $adminLogin);
15
+		$tokens = $this->proxy('password', [
16
+			'username' => $credentials['email'],
17
+			'password' => $credentials['password']
18
+		]);
19 19
 
20
-        return compact('user', 'tokens');
21
-    }
20
+		return compact('user', 'tokens');
21
+	}
22 22
 
23
-    /**
24
-     * Attempt to refresh the access token useing the given refresh token.
25
-     *
26
-     * @param  string $refreshToken
27
-     * @return array
28
-     */
29
-    public function refreshtoken($refreshToken)
30
-    {
31
-        return $this->proxy('refresh_token', [
32
-            'refresh_token' => $refreshToken
33
-        ]);
34
-    }
23
+	/**
24
+	 * Attempt to refresh the access token useing the given refresh token.
25
+	 *
26
+	 * @param  string $refreshToken
27
+	 * @return array
28
+	 */
29
+	public function refreshtoken($refreshToken)
30
+	{
31
+		return $this->proxy('refresh_token', [
32
+			'refresh_token' => $refreshToken
33
+		]);
34
+	}
35 35
 
36
-    /**
37
-     * Proxy a request to the OAuth server.
38
-     *
39
-     * @param string $grantType what type of grant type should be proxied
40
-     * @param array
41
-     */
42
-    public function proxy($grantType, array $data = [])
43
-    {
44
-        $data = array_merge($data, [
45
-            'client_id'     => config('skeleton.passport_client_id'),
46
-            'client_secret' => config('skeleton.passport_client_secret'),
47
-            'grant_type'    => $grantType
48
-        ]);
36
+	/**
37
+	 * Proxy a request to the OAuth server.
38
+	 *
39
+	 * @param string $grantType what type of grant type should be proxied
40
+	 * @param array
41
+	 */
42
+	public function proxy($grantType, array $data = [])
43
+	{
44
+		$data = array_merge($data, [
45
+			'client_id'     => config('skeleton.passport_client_id'),
46
+			'client_secret' => config('skeleton.passport_client_secret'),
47
+			'grant_type'    => $grantType
48
+		]);
49 49
 
50
-        $response = \ApiConsumer::post('/oauth/token', $data);
50
+		$response = \ApiConsumer::post('/oauth/token', $data);
51 51
 
52
-        if (! $response->isSuccessful()) {
53
-            if ($grantType == 'refresh_token') {
54
-                \ErrorHandler::invalidRefreshToken();
55
-            }
52
+		if (! $response->isSuccessful()) {
53
+			if ($grantType == 'refresh_token') {
54
+				\ErrorHandler::invalidRefreshToken();
55
+			}
56 56
 
57
-            \ErrorHandler::loginFailed();
58
-        }
57
+			\ErrorHandler::loginFailed();
58
+		}
59 59
 
60
-        $data = json_decode($response->getContent());
60
+		$data = json_decode($response->getContent());
61 61
 
62
-        return [
63
-            'access_token'  => $data->access_token,
64
-            'refresh_token' => $data->refresh_token,
65
-            'expires_in'    => $data->expires_in
66
-        ];
67
-    }
62
+		return [
63
+			'access_token'  => $data->access_token,
64
+			'refresh_token' => $data->refresh_token,
65
+			'expires_in'    => $data->expires_in
66
+		];
67
+	}
68 68
 
69
-    /**
70
-     * Logs out the user. We revoke access token and refresh token.
71
-     *
72
-     * @return void
73
-     */
74
-    public function logout()
75
-    {
76
-        \Core::users()->revokeAccessToken(\Auth::user()->token());
77
-    }
69
+	/**
70
+	 * Logs out the user. We revoke access token and refresh token.
71
+	 *
72
+	 * @return void
73
+	 */
74
+	public function logout()
75
+	{
76
+		\Core::users()->revokeAccessToken(\Auth::user()->token());
77
+	}
78 78
 }
Please login to merge, or discard this patch.
src/Modules/Reporting/Http/Resources/Report.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -6,20 +6,20 @@
 block discarded – undo
6 6
 
7 7
 class Report extends JsonResource
8 8
 {
9
-    /**
10
-     * Transform the resource into an array.
11
-     *
12
-     * @param  \Illuminate\Http\Request  $request
13
-     * @return array
14
-     */
15
-    public function toArray($request)
16
-    {
17
-        return [
18
-            'id' => $this->id,
19
-            'reportName' => $this->report_name,
20
-            'viewName' => $this->view_name,
21
-            'createdAt' => $this->created_at,
22
-            'updatedAt' => $this->updated_at,
23
-        ];
24
-    }
9
+	/**
10
+	 * Transform the resource into an array.
11
+	 *
12
+	 * @param  \Illuminate\Http\Request  $request
13
+	 * @return array
14
+	 */
15
+	public function toArray($request)
16
+	{
17
+		return [
18
+			'id' => $this->id,
19
+			'reportName' => $this->report_name,
20
+			'viewName' => $this->view_name,
21
+			'createdAt' => $this->created_at,
22
+			'updatedAt' => $this->updated_at,
23
+		];
24
+	}
25 25
 }
Please login to merge, or discard this patch.