Completed
Push — master ( 0f747c...09a64e )
by Sherif
01:52
created
src/Modules/OauthClients/Database/Seeds/AssignRelationsSeeder.php 2 patches
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.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
         /**
19 19
          * Assign the permissions to the admin role.
20 20
          */
21
-        \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['oauthClient'])->each(function ($permission) use ($adminRoleId) {
21
+        \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['oauthClient'])->each(function($permission) use ($adminRoleId) {
22 22
             \DB::table('permission_role')->insert(
23 23
                 [
24 24
                 'permission_id' => $permission->id,
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/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 2 patches
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.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
         /**
19 19
          * Assign the permissions to the admin role.
20 20
          */
21
-        \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['notification', 'pushNotificationDevice'])->each(function ($permission) use ($adminRoleId) {
21
+        \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['notification', 'pushNotificationDevice'])->each(function($permission) use ($adminRoleId) {
22 22
             \DB::table('permission_role')->insert(
23 23
                 [
24 24
                 'permission_id' => $permission->id,
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.
src/Modules/Notifications/Http/Controllers/NotificationController.php 1 patch
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -9,71 +9,71 @@
 block discarded – undo
9 9
 
10 10
 class NotificationController extends BaseApiController
11 11
 {
12
-    /**
13
-     * Path of the model resource
14
-     *
15
-     * @var string
16
-     */
17
-    protected $modelResource = 'App\Modules\Notifications\Http\Resources\Notification';
12
+	/**
13
+	 * Path of the model resource
14
+	 *
15
+	 * @var string
16
+	 */
17
+	protected $modelResource = 'App\Modules\Notifications\Http\Resources\Notification';
18 18
 
19
-    /**
20
-     * List of all route actions that the base api controller
21
-     * will skip permissions check for them.
22
-     * @var array
23
-     */
24
-    protected $skipPermissionCheck = ['markAsRead', 'markAllAsRead', 'index', 'unread'];
19
+	/**
20
+	 * List of all route actions that the base api controller
21
+	 * will skip permissions check for them.
22
+	 * @var array
23
+	 */
24
+	protected $skipPermissionCheck = ['markAsRead', 'markAllAsRead', 'index', 'unread'];
25 25
 
26
-    /**
27
-     * Init new object.
28
-     *
29
-     * @param   NotificationService $service
30
-     * @return  void
31
-     */
32
-    public function __construct(NotificationService $service)
33
-    {
34
-        parent::__construct($service);
35
-    }
26
+	/**
27
+	 * Init new object.
28
+	 *
29
+	 * @param   NotificationService $service
30
+	 * @return  void
31
+	 */
32
+	public function __construct(NotificationService $service)
33
+	{
34
+		parent::__construct($service);
35
+	}
36 36
 
37
-    /**
38
-     * Retrieve all notifications of the logged in user.
39
-     *
40
-     * @param Request $request
41
-     * @return \Illuminate\Http\Response
42
-     */
43
-    public function index(Request $request)
44
-    {
45
-        return $this->modelResource::collection($this->service->my($request->query('perPage')));
46
-    }
37
+	/**
38
+	 * Retrieve all notifications of the logged in user.
39
+	 *
40
+	 * @param Request $request
41
+	 * @return \Illuminate\Http\Response
42
+	 */
43
+	public function index(Request $request)
44
+	{
45
+		return $this->modelResource::collection($this->service->my($request->query('perPage')));
46
+	}
47 47
 
48
-    /**
49
-     * Retrieve unread notifications of the logged in user.
50
-     *
51
-     * @param Request $request
52
-     * @return \Illuminate\Http\Response
53
-     */
54
-    public function unread(Request $request)
55
-    {
56
-        return $this->modelResource::collection($this->service->unread($request->query('perPage')));
57
-    }
48
+	/**
49
+	 * Retrieve unread notifications of the logged in user.
50
+	 *
51
+	 * @param Request $request
52
+	 * @return \Illuminate\Http\Response
53
+	 */
54
+	public function unread(Request $request)
55
+	{
56
+		return $this->modelResource::collection($this->service->unread($request->query('perPage')));
57
+	}
58 58
 
59
-    /**
60
-     * Mark the notification as read.
61
-     *
62
-     * @param  integer  $id Id of the notification.
63
-     * @return \Illuminate\Http\Response
64
-     */
65
-    public function markAsRead($id)
66
-    {
67
-        return new GeneralResource($this->service->markAsRead($id));
68
-    }
59
+	/**
60
+	 * Mark the notification as read.
61
+	 *
62
+	 * @param  integer  $id Id of the notification.
63
+	 * @return \Illuminate\Http\Response
64
+	 */
65
+	public function markAsRead($id)
66
+	{
67
+		return new GeneralResource($this->service->markAsRead($id));
68
+	}
69 69
 
70
-    /**
71
-     * Mark all notifications as read.
72
-     *
73
-     * @return \Illuminate\Http\Response
74
-     */
75
-    public function markAllAsRead()
76
-    {
77
-        return new GeneralResource($this->service->markAllAsRead());
78
-    }
70
+	/**
71
+	 * Mark all notifications as read.
72
+	 *
73
+	 * @return \Illuminate\Http\Response
74
+	 */
75
+	public function markAllAsRead()
76
+	{
77
+		return new GeneralResource($this->service->markAllAsRead());
78
+	}
79 79
 }
Please login to merge, or discard this patch.
src/Modules/Roles/Database/Seeds/AssignRelationsSeeder.php 2 patches
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', ['role'])->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', ['role'])->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.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
         /**
19 19
          * Assign the permissions to the admin role.
20 20
          */
21
-        \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['role'])->each(function ($permission) use ($adminRoleId) {
21
+        \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['role'])->each(function($permission) use ($adminRoleId) {
22 22
             \DB::table('permission_role')->insert(
23 23
                 [
24 24
                 'permission_id' => $permission->id,
Please login to merge, or discard this patch.
src/Modules/Roles/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', ['role']);
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', ['role']);
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/Roles/Database/Migrations/2015_12_22_145819_roles.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@
 block discarded – undo
12 12
      */
13 13
     public function up()
14 14
     {
15
-        Schema::create('roles', function (Blueprint $table) {
15
+        Schema::create('roles', function(Blueprint $table) {
16 16
             $table->increments('id');
17 17
             $table->string('name', 100)->unique();
18 18
             $table->softDeletes();
19 19
             $table->timestamps();
20 20
         });
21 21
         
22
-        Schema::create('role_user', function (Blueprint $table) {
22
+        Schema::create('role_user', function(Blueprint $table) {
23 23
             $table->increments('id');
24 24
             $table->unsignedInteger('user_id');
25 25
             $table->unsignedInteger('role_id');
Please login to merge, or discard this patch.
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -5,40 +5,40 @@
 block discarded – undo
5 5
 
6 6
 class Roles extends Migration
7 7
 {
8
-    /**
9
-     * Run the migrations.
10
-     *
11
-     * @return void
12
-     */
13
-    public function up()
14
-    {
15
-        Schema::create('roles', function (Blueprint $table) {
16
-            $table->increments('id');
17
-            $table->string('name', 100)->unique();
18
-            $table->softDeletes();
19
-            $table->timestamps();
20
-        });
8
+	/**
9
+	 * Run the migrations.
10
+	 *
11
+	 * @return void
12
+	 */
13
+	public function up()
14
+	{
15
+		Schema::create('roles', function (Blueprint $table) {
16
+			$table->increments('id');
17
+			$table->string('name', 100)->unique();
18
+			$table->softDeletes();
19
+			$table->timestamps();
20
+		});
21 21
         
22
-        Schema::create('role_user', function (Blueprint $table) {
23
-            $table->increments('id');
24
-            $table->unsignedInteger('user_id');
25
-            $table->unsignedInteger('role_id');
26
-            $table->softDeletes();
27
-            $table->timestamps();
22
+		Schema::create('role_user', function (Blueprint $table) {
23
+			$table->increments('id');
24
+			$table->unsignedInteger('user_id');
25
+			$table->unsignedInteger('role_id');
26
+			$table->softDeletes();
27
+			$table->timestamps();
28 28
 
29
-            $table->foreign('user_id')->references('id')->on('users');
30
-            $table->foreign('role_id')->references('id')->on('roles');
31
-        });
32
-    }
29
+			$table->foreign('user_id')->references('id')->on('users');
30
+			$table->foreign('role_id')->references('id')->on('roles');
31
+		});
32
+	}
33 33
 
34
-    /**
35
-     * Reverse the migrations.
36
-     *
37
-     * @return void
38
-     */
39
-    public function down()
40
-    {
41
-        Schema::dropIfExists('role_user');
42
-        Schema::dropIfExists('roles');
43
-    }
34
+	/**
35
+	 * Reverse the migrations.
36
+	 *
37
+	 * @return void
38
+	 */
39
+	public function down()
40
+	{
41
+		Schema::dropIfExists('role_user');
42
+		Schema::dropIfExists('roles');
43
+	}
44 44
 }
Please login to merge, or discard this patch.