Completed
Push — master ( f30158...bfbb50 )
by Sherif
02:18
created
src/Modules/Permissions/Services/PermissionService.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -5,14 +5,14 @@
 block discarded – undo
5 5
 
6 6
 class PermissionService extends BaseService
7 7
 {
8
-    /**
9
-     * Init new object.
10
-     *
11
-     * @param   PermissionRepository $repo
12
-     * @return  void
13
-     */
14
-    public function __construct(PermissionRepository $repo)
15
-    {
16
-        parent::__construct($repo);
17
-    }
8
+	/**
9
+	 * Init new object.
10
+	 *
11
+	 * @param   PermissionRepository $repo
12
+	 * @return  void
13
+	 */
14
+	public function __construct(PermissionRepository $repo)
15
+	{
16
+		parent::__construct($repo);
17
+	}
18 18
 }
Please login to merge, or discard this patch.
src/Modules/OauthClients/Repositories/OauthClientRepository.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -5,64 +5,64 @@
 block discarded – undo
5 5
 
6 6
 class OauthClientRepository extends BaseRepository
7 7
 {
8
-    /**
9
-     * Init new object.
10
-     *
11
-     * @param   OauthClient $model
12
-     * @return  void
13
-     */
14
-    public function __construct(OauthClient $model)
15
-    {
16
-        parent::__construct($model);
17
-    }
8
+	/**
9
+	 * Init new object.
10
+	 *
11
+	 * @param   OauthClient $model
12
+	 * @return  void
13
+	 */
14
+	public function __construct(OauthClient $model)
15
+	{
16
+		parent::__construct($model);
17
+	}
18 18
 
19
-    /**
20
-     * Revoke the given client tokens.
21
-     *
22
-     * @param  mixed  $client
23
-     * @return void
24
-     */
25
-    public function revokeClientTokens($client)
26
-    {
27
-        $client = is_int($client) ? $client : $this->find($client);
28
-        $client->tokens()->update(['revoked' => true]);
29
-    }
19
+	/**
20
+	 * Revoke the given client tokens.
21
+	 *
22
+	 * @param  mixed  $client
23
+	 * @return void
24
+	 */
25
+	public function revokeClientTokens($client)
26
+	{
27
+		$client = is_int($client) ? $client : $this->find($client);
28
+		$client->tokens()->update(['revoked' => true]);
29
+	}
30 30
 
31
-    /**
32
-     * Ensure access token hasn't expired or revoked.
33
-     *
34
-     * @param  string $accessToken
35
-     * @return boolean
36
-     */
37
-    public function accessTokenExpiredOrRevoked($accessToken)
38
-    {
39
-        $accessTokenId = json_decode($accessToken, true)['id'];
40
-        $accessToken   = \DB::table('oauth_access_tokens')
41
-                ->where('id', $accessTokenId)
42
-                ->first();
31
+	/**
32
+	 * Ensure access token hasn't expired or revoked.
33
+	 *
34
+	 * @param  string $accessToken
35
+	 * @return boolean
36
+	 */
37
+	public function accessTokenExpiredOrRevoked($accessToken)
38
+	{
39
+		$accessTokenId = json_decode($accessToken, true)['id'];
40
+		$accessToken   = \DB::table('oauth_access_tokens')
41
+				->where('id', $accessTokenId)
42
+				->first();
43 43
         
44
-        if (\Carbon\Carbon::parse($accessToken->expires_at)->isPast() || $accessToken->revoked) {
45
-            return true;
46
-        }
44
+		if (\Carbon\Carbon::parse($accessToken->expires_at)->isPast() || $accessToken->revoked) {
45
+			return true;
46
+		}
47 47
 
48
-        return false;
49
-    }
48
+		return false;
49
+	}
50 50
 
51
-    /**
52
-     * Revoke the given access token and all
53
-     * associated refresh tokens.
54
-     *
55
-     * @param  oject $accessToken
56
-     * @return void
57
-     */
58
-    public function revokeAccessToken($accessToken)
59
-    {
60
-        \DB::table('oauth_refresh_tokens')
61
-            ->where('access_token_id', $accessToken->id)
62
-            ->update([
63
-                'revoked' => true
64
-            ]);
51
+	/**
52
+	 * Revoke the given access token and all
53
+	 * associated refresh tokens.
54
+	 *
55
+	 * @param  oject $accessToken
56
+	 * @return void
57
+	 */
58
+	public function revokeAccessToken($accessToken)
59
+	{
60
+		\DB::table('oauth_refresh_tokens')
61
+			->where('access_token_id', $accessToken->id)
62
+			->update([
63
+				'revoked' => true
64
+			]);
65 65
 
66
-        $accessToken->revoke();
67
-    }
66
+		$accessToken->revoke();
67
+	}
68 68
 }
Please login to merge, or discard this patch.
src/Modules/OauthClients/Database/Seeds/AssignRelationsSeeder.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -6,27 +6,27 @@
 block discarded – undo
6 6
 
7 7
 class AssignRelationsSeeder extends Seeder
8 8
 {
9
-    /**
10
-     * Run the database seeds.
11
-     *
12
-     * @return void
13
-     */
14
-    public function run()
15
-    {
16
-        $adminRoleId = \DB::table('roles')->where('name', 'admin')->select('id')->first()->id;
9
+	/**
10
+	 * Run the database seeds.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function run()
15
+	{
16
+		$adminRoleId = \DB::table('roles')->where('name', 'admin')->select('id')->first()->id;
17 17
 
18
-        /**
19
-         * Assign the permissions to the admin role.
20
-         */
21
-        \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['oauthClient'])->each(function ($permission) use ($adminRoleId) {
22
-            \DB::table('permission_role')->insert(
23
-                [
24
-                'permission_id' => $permission->id,
25
-                'role_id'      => $adminRoleId,
26
-                'created_at'    => \DB::raw('NOW()'),
27
-                'updated_at'    => \DB::raw('NOW()')
28
-                ]
29
-            );
30
-        });
31
-    }
18
+		/**
19
+		 * Assign the permissions to the admin role.
20
+		 */
21
+		\DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['oauthClient'])->each(function ($permission) use ($adminRoleId) {
22
+			\DB::table('permission_role')->insert(
23
+				[
24
+				'permission_id' => $permission->id,
25
+				'role_id'      => $adminRoleId,
26
+				'created_at'    => \DB::raw('NOW()'),
27
+				'updated_at'    => \DB::raw('NOW()')
28
+				]
29
+			);
30
+		});
31
+	}
32 32
 }
Please login to merge, or discard this patch.
src/Modules/OauthClients/Database/Seeds/ClearDataSeeder.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -6,15 +6,15 @@
 block discarded – undo
6 6
 
7 7
 class ClearDataSeeder extends Seeder
8 8
 {
9
-    /**
10
-     * Run the database seeds.
11
-     *
12
-     * @return void
13
-     */
14
-    public function run()
15
-    {
16
-        $permissions = \DB::table('permissions')->whereIn('model', ['oauthClient']);
17
-        \DB::table('permission_role')->whereIn('permission_id', $permissions->pluck('id'))->delete();
18
-        $permissions->delete();
19
-    }
9
+	/**
10
+	 * Run the database seeds.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function run()
15
+	{
16
+		$permissions = \DB::table('permissions')->whereIn('model', ['oauthClient']);
17
+		\DB::table('permission_role')->whereIn('permission_id', $permissions->pluck('id'))->delete();
18
+		$permissions->delete();
19
+	}
20 20
 }
Please login to merge, or discard this patch.
src/Modules/OauthClients/Http/Controllers/OauthClientController.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -10,65 +10,65 @@
 block discarded – undo
10 10
 
11 11
 class OauthClientController extends BaseApiController
12 12
 {
13
-    /**
14
-     * Path of the model resource
15
-     *
16
-     * @var string
17
-     */
18
-    protected $modelResource = 'App\Modules\OauthClients\Http\Resources\OauthClient';
13
+	/**
14
+	 * Path of the model resource
15
+	 *
16
+	 * @var string
17
+	 */
18
+	protected $modelResource = 'App\Modules\OauthClients\Http\Resources\OauthClient';
19 19
 
20
-    /**
21
-     * Init new object.
22
-     *
23
-     * @param   OauthClientService $service
24
-     * @return  void
25
-     */
26
-    public function __construct(OauthClientService $service)
27
-    {
28
-        parent::__construct($service);
29
-    }
20
+	/**
21
+	 * Init new object.
22
+	 *
23
+	 * @param   OauthClientService $service
24
+	 * @return  void
25
+	 */
26
+	public function __construct(OauthClientService $service)
27
+	{
28
+		parent::__construct($service);
29
+	}
30 30
 
31
-    /**
32
-     * Insert the given model to storage.
33
-     *
34
-     * @param InsertOauthClient $request
35
-     * @return \Illuminate\Http\Response
36
-     */
37
-    public function insert(InsertOauthClient $request)
38
-    {
39
-        return new $this->modelResource($this->service->save($request->all()));
40
-    }
31
+	/**
32
+	 * Insert the given model to storage.
33
+	 *
34
+	 * @param InsertOauthClient $request
35
+	 * @return \Illuminate\Http\Response
36
+	 */
37
+	public function insert(InsertOauthClient $request)
38
+	{
39
+		return new $this->modelResource($this->service->save($request->all()));
40
+	}
41 41
 
42
-    /**
43
-     * Update the given model to storage.
44
-     *
45
-     * @param UpdateOauthClient $request
46
-     * @return \Illuminate\Http\Response
47
-     */
48
-    public function update(UpdateOauthClient $request)
49
-    {
50
-        return new $this->modelResource($this->service->save($request->all()));
51
-    }
42
+	/**
43
+	 * Update the given model to storage.
44
+	 *
45
+	 * @param UpdateOauthClient $request
46
+	 * @return \Illuminate\Http\Response
47
+	 */
48
+	public function update(UpdateOauthClient $request)
49
+	{
50
+		return new $this->modelResource($this->service->save($request->all()));
51
+	}
52 52
 
53
-    /**
54
-     * Revoke the given client.
55
-     *
56
-     * @param  integer  $clientId Id of the client
57
-     * @return \Illuminate\Http\Response
58
-     */
59
-    public function revoke($clientId)
60
-    {
61
-        return new GeneralResource($this->service->revoke($clientId));
62
-    }
53
+	/**
54
+	 * Revoke the given client.
55
+	 *
56
+	 * @param  integer  $clientId Id of the client
57
+	 * @return \Illuminate\Http\Response
58
+	 */
59
+	public function revoke($clientId)
60
+	{
61
+		return new GeneralResource($this->service->revoke($clientId));
62
+	}
63 63
 
64
-    /**
65
-     * Un revoke the given client.
66
-     *
67
-     * @param  integer  $clientId Id of the client
68
-     * @return \Illuminate\Http\Response
69
-     */
70
-    public function unRevoke($clientId)
71
-    {
72
-        return new GeneralResource($this->service->unRevoke($clientId));
73
-    }
64
+	/**
65
+	 * Un revoke the given client.
66
+	 *
67
+	 * @param  integer  $clientId Id of the client
68
+	 * @return \Illuminate\Http\Response
69
+	 */
70
+	public function unRevoke($clientId)
71
+	{
72
+		return new GeneralResource($this->service->unRevoke($clientId));
73
+	}
74 74
 }
Please login to merge, or discard this patch.
src/Modules/OauthClients/Services/OauthClientService.php 1 patch
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -5,63 +5,63 @@
 block discarded – undo
5 5
 
6 6
 class OauthClientService extends BaseService
7 7
 {
8
-    /**
9
-     * Init new object.
10
-     *
11
-     * @param   OauthClientRepository $repo
12
-     * @return  void
13
-     */
14
-    public function __construct(OauthClientRepository $repo)
15
-    {
16
-        parent::__construct($repo);
17
-    }
8
+	/**
9
+	 * Init new object.
10
+	 *
11
+	 * @param   OauthClientRepository $repo
12
+	 * @return  void
13
+	 */
14
+	public function __construct(OauthClientRepository $repo)
15
+	{
16
+		parent::__construct($repo);
17
+	}
18 18
 
19
-    /**
20
-     * Revoke the given client.
21
-     *
22
-     * @param  integer  $clientId
23
-     * @return void
24
-     */
25
-    public function revoke($clientId)
26
-    {
27
-        \DB::transaction(function () use ($data) {
28
-            $client = $this->repo->find($clientId);
29
-            $this->repo->revokeClientTokens($client);
30
-            $this->repo->save(['id'=> $clientId, 'revoked' => true]);
31
-        });
32
-    }
19
+	/**
20
+	 * Revoke the given client.
21
+	 *
22
+	 * @param  integer  $clientId
23
+	 * @return void
24
+	 */
25
+	public function revoke($clientId)
26
+	{
27
+		\DB::transaction(function () use ($data) {
28
+			$client = $this->repo->find($clientId);
29
+			$this->repo->revokeClientTokens($client);
30
+			$this->repo->save(['id'=> $clientId, 'revoked' => true]);
31
+		});
32
+	}
33 33
 
34
-    /**
35
-     * UnRevoke the given client.
36
-     *
37
-     * @param  integer  $clientId
38
-     * @return void
39
-     */
40
-    public function unRevoke($clientId)
41
-    {
42
-        $this->repo->save(['id'=> $clientId, 'revoked' => false]);
43
-    }
34
+	/**
35
+	 * UnRevoke the given client.
36
+	 *
37
+	 * @param  integer  $clientId
38
+	 * @return void
39
+	 */
40
+	public function unRevoke($clientId)
41
+	{
42
+		$this->repo->save(['id'=> $clientId, 'revoked' => false]);
43
+	}
44 44
 
45
-    /**
46
-     * Ensure access token hasn't expired or revoked.
47
-     *
48
-     * @param  string $accessToken
49
-     * @return boolean
50
-     */
51
-    public function accessTokenExpiredOrRevoked($accessToken)
52
-    {
53
-        return $this->oauthClientRepository->accessTokenExpiredOrRevoked($accessToken);
54
-    }
45
+	/**
46
+	 * Ensure access token hasn't expired or revoked.
47
+	 *
48
+	 * @param  string $accessToken
49
+	 * @return boolean
50
+	 */
51
+	public function accessTokenExpiredOrRevoked($accessToken)
52
+	{
53
+		return $this->oauthClientRepository->accessTokenExpiredOrRevoked($accessToken);
54
+	}
55 55
 
56
-    /**
57
-     * Revoke the given access token and all
58
-     * associated refresh tokens.
59
-     *
60
-     * @param  oject $accessToken
61
-     * @return void
62
-     */
63
-    public function revokeAccessToken($accessToken)
64
-    {
65
-        return $this->oauthClientRepository->revokeAccessToken($accessToken);
66
-    }
56
+	/**
57
+	 * Revoke the given access token and all
58
+	 * associated refresh tokens.
59
+	 *
60
+	 * @param  oject $accessToken
61
+	 * @return void
62
+	 */
63
+	public function revokeAccessToken($accessToken)
64
+	{
65
+		return $this->oauthClientRepository->revokeAccessToken($accessToken);
66
+	}
67 67
 }
Please login to merge, or discard this patch.
src/Modules/Notifications/Repositories/NotificationRepository.php 1 patch
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -5,59 +5,59 @@
 block discarded – undo
5 5
 
6 6
 class NotificationRepository extends BaseRepository
7 7
 {
8
-    /**
9
-     * Init new object.
10
-     *
11
-     * @param   Notification $model
12
-     * @return  void
13
-     */
14
-    public function __construct(Notification $model)
15
-    {
16
-        parent::__construct($model);
17
-    }
8
+	/**
9
+	 * Init new object.
10
+	 *
11
+	 * @param   Notification $model
12
+	 * @return  void
13
+	 */
14
+	public function __construct(Notification $model)
15
+	{
16
+		parent::__construct($model);
17
+	}
18 18
 
19
-    /**
20
-     * Retrieve all notifications of the logged in user.
21
-     *
22
-     * @param  integer $perPage
23
-     * @return Collection
24
-     */
25
-    public function my($perPage)
26
-    {
27
-        return \Auth::user()->notifications()->paginate($perPage);
28
-    }
19
+	/**
20
+	 * Retrieve all notifications of the logged in user.
21
+	 *
22
+	 * @param  integer $perPage
23
+	 * @return Collection
24
+	 */
25
+	public function my($perPage)
26
+	{
27
+		return \Auth::user()->notifications()->paginate($perPage);
28
+	}
29 29
 
30
-    /**
31
-     * Retrieve unread notifications of the logged in user.
32
-     *
33
-     * @param  integer $perPage
34
-     * @return Collection
35
-     */
36
-    public function unread($perPage)
37
-    {
38
-        return \Auth::user()->unreadNotifications()->paginate($perPage);
39
-    }
30
+	/**
31
+	 * Retrieve unread notifications of the logged in user.
32
+	 *
33
+	 * @param  integer $perPage
34
+	 * @return Collection
35
+	 */
36
+	public function unread($perPage)
37
+	{
38
+		return \Auth::user()->unreadNotifications()->paginate($perPage);
39
+	}
40 40
 
41
-    /**
42
-     * Mark the notification as read.
43
-     *
44
-     * @param  integer  $id
45
-     * @return object
46
-     */
47
-    public function markAsRead($id)
48
-    {
49
-        if ($notification = \Auth::user()->unreadNotifications()->where('id', $id)->first()) {
50
-            $notification->markAsRead();
51
-        }
52
-    }
41
+	/**
42
+	 * Mark the notification as read.
43
+	 *
44
+	 * @param  integer  $id
45
+	 * @return object
46
+	 */
47
+	public function markAsRead($id)
48
+	{
49
+		if ($notification = \Auth::user()->unreadNotifications()->where('id', $id)->first()) {
50
+			$notification->markAsRead();
51
+		}
52
+	}
53 53
 
54
-    /**
55
-     * Mark all notifications as read.
56
-     *
57
-     * @return void
58
-     */
59
-    public function markAllAsRead()
60
-    {
61
-        \Auth::user()->unreadNotifications()->update(['read_at' => now()]);
62
-    }
54
+	/**
55
+	 * Mark all notifications as read.
56
+	 *
57
+	 * @return void
58
+	 */
59
+	public function markAllAsRead()
60
+	{
61
+		\Auth::user()->unreadNotifications()->update(['read_at' => now()]);
62
+	}
63 63
 }
Please login to merge, or discard this patch.
src/Modules/Notifications/Database/Seeds/AssignRelationsSeeder.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -6,27 +6,27 @@
 block discarded – undo
6 6
 
7 7
 class AssignRelationsSeeder extends Seeder
8 8
 {
9
-    /**
10
-     * Run the database seeds.
11
-     *
12
-     * @return void
13
-     */
14
-    public function run()
15
-    {
16
-        $adminRoleId = \DB::table('roles')->where('name', 'admin')->select('id')->first()->id;
9
+	/**
10
+	 * Run the database seeds.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function run()
15
+	{
16
+		$adminRoleId = \DB::table('roles')->where('name', 'admin')->select('id')->first()->id;
17 17
 
18
-        /**
19
-         * Assign the permissions to the admin role.
20
-         */
21
-        \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['notification', 'pushNotificationDevice'])->each(function ($permission) use ($adminRoleId) {
22
-            \DB::table('permission_role')->insert(
23
-                [
24
-                'permission_id' => $permission->id,
25
-                'role_id'      => $adminRoleId,
26
-                'created_at'    => \DB::raw('NOW()'),
27
-                'updated_at'    => \DB::raw('NOW()')
28
-                ]
29
-            );
30
-        });
31
-    }
18
+		/**
19
+		 * Assign the permissions to the admin role.
20
+		 */
21
+		\DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['notification', 'pushNotificationDevice'])->each(function ($permission) use ($adminRoleId) {
22
+			\DB::table('permission_role')->insert(
23
+				[
24
+				'permission_id' => $permission->id,
25
+				'role_id'      => $adminRoleId,
26
+				'created_at'    => \DB::raw('NOW()'),
27
+				'updated_at'    => \DB::raw('NOW()')
28
+				]
29
+			);
30
+		});
31
+	}
32 32
 }
Please login to merge, or discard this patch.
src/Modules/Notifications/Database/Seeds/ClearDataSeeder.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -6,15 +6,15 @@
 block discarded – undo
6 6
 
7 7
 class ClearDataSeeder extends Seeder
8 8
 {
9
-    /**
10
-     * Run the database seeds.
11
-     *
12
-     * @return void
13
-     */
14
-    public function run()
15
-    {
16
-        $permissions = \DB::table('permissions')->whereIn('model', ['notification', 'pushNotificationDevice']);
17
-        \DB::table('permission_role')->whereIn('permission_id', $permissions->pluck('id'))->delete();
18
-        $permissions->delete();
19
-    }
9
+	/**
10
+	 * Run the database seeds.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function run()
15
+	{
16
+		$permissions = \DB::table('permissions')->whereIn('model', ['notification', 'pushNotificationDevice']);
17
+		\DB::table('permission_role')->whereIn('permission_id', $permissions->pluck('id'))->delete();
18
+		$permissions->delete();
19
+	}
20 20
 }
Please login to merge, or discard this patch.