Completed
Push — master ( 782f26...cf2713 )
by Sherif
02:10
created
src/Modules/Users/AclUser.php 1 patch
Indentation   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -7,133 +7,133 @@
 block discarded – undo
7 7
 class AclUser extends User
8 8
 {
9 9
 
10
-    use SoftDeletes, HasApiTokens;
11
-    protected $table    = 'users';
12
-    protected $dates    = ['created_at', 'updated_at', 'deleted_at'];
13
-    protected $hidden   = ['password', 'remember_token', 'deleted_at'];
14
-    protected $guarded  = ['id'];
15
-    protected $fillable = ['profile_picture', 'name', 'email', 'password', 'locale', 'timezone'];
16
-    public $searchable  = ['name', 'email'];
10
+	use SoftDeletes, HasApiTokens;
11
+	protected $table    = 'users';
12
+	protected $dates    = ['created_at', 'updated_at', 'deleted_at'];
13
+	protected $hidden   = ['password', 'remember_token', 'deleted_at'];
14
+	protected $guarded  = ['id'];
15
+	protected $fillable = ['profile_picture', 'name', 'email', 'password', 'locale', 'timezone'];
16
+	public $searchable  = ['name', 'email'];
17 17
     
18
-    public function getCreatedAtAttribute($value)
19
-    {
20
-        return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
21
-    }
22
-
23
-    public function getUpdatedAtAttribute($value)
24
-    {
25
-        return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
26
-    }
27
-
28
-    public function getDeletedAtAttribute($value)
29
-    {
30
-        return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
31
-    }
32
-
33
-    /**
34
-     * Get the profile picture url.
35
-     * @return string
36
-     */
37
-    public function getProfilePictureAttribute($value)
38
-    {
39
-        return url(\Storage::url($value));
40
-    }
41
-
42
-    /**
43
-     * Encrypt the password attribute before
44
-     * saving it in the storage.
45
-     *
46
-     * @param string $value
47
-     */
48
-    public function setPasswordAttribute($value)
49
-    {
50
-        $this->attributes['password'] = bcrypt($value);
51
-    }
52
-
53
-    /**
54
-     * Get the entity's notifications.
55
-     */
56
-    public function notifications()
57
-    {
58
-        return $this->morphMany('App\Modules\Notifications\Notification', 'notifiable')->orderBy('created_at', 'desc');
59
-    }
60
-
61
-    /**
62
-     * Get the entity's read notifications.
63
-     */
64
-    public function readNotifications()
65
-    {
66
-        return $this->notifications()->whereNotNull('read_at');
67
-    }
68
-
69
-    /**
70
-     * Get the entity's unread notifications.
71
-     */
72
-    public function unreadNotifications()
73
-    {
74
-        return $this->notifications()->whereNull('read_at');
75
-    }
76
-
77
-    public function roles()
78
-    {
79
-        return $this->belongsToMany('App\Modules\Roles\Role', 'users_roles', 'user_id', 'role_id')->whereNull('users_roles.deleted_at')->withTimestamps();
80
-    }
81
-
82
-    public function oauthClients()
83
-    {
84
-        return $this->hasMany('App\Modules\OauthClients\OauthClient', 'user_id');
85
-    }
86
-
87
-    /**
88
-     * Return fcm device tokens that will be used in sending fcm notifications.
89
-     *
90
-     * @return array
91
-     */
92
-    public function routeNotificationForFCM()
93
-    {
94
-        $devices = \Core::pushNotificationDevices()->findBy(['user_id' => $this->id]);
95
-        $tokens  = [];
96
-
97
-        foreach ($devices as $device) {
98
-            if (\Core::users()->accessTokenExpiredOrRevoked($device->access_token)) {
99
-                $device->forceDelete();
100
-                continue;
101
-            }
102
-
103
-            $tokens[] = $device->device_token;
104
-        }
105
-
106
-        return $tokens;
107
-    }
108
-
109
-    /**
110
-     * The channels the user receives notification broadcasts on.
111
-     *
112
-     * @return string
113
-     */
114
-    public function receivesBroadcastNotificationsOn()
115
-    {
116
-        return 'users.'.$this->id;
117
-    }
118
-
119
-    /**
120
-     * Custom password validation.
121
-     *
122
-     * @param  string $password
123
-     * @return boolean
124
-     */
125
-    public function validateForPassportPasswordGrant($password)
126
-    {
127
-        if ($password == config('skeleton.social_pass')) {
128
-            return true;
129
-        }
130
-
131
-        return \Hash::check($password, $this->password);
132
-    }
18
+	public function getCreatedAtAttribute($value)
19
+	{
20
+		return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
21
+	}
22
+
23
+	public function getUpdatedAtAttribute($value)
24
+	{
25
+		return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
26
+	}
27
+
28
+	public function getDeletedAtAttribute($value)
29
+	{
30
+		return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
31
+	}
32
+
33
+	/**
34
+	 * Get the profile picture url.
35
+	 * @return string
36
+	 */
37
+	public function getProfilePictureAttribute($value)
38
+	{
39
+		return url(\Storage::url($value));
40
+	}
41
+
42
+	/**
43
+	 * Encrypt the password attribute before
44
+	 * saving it in the storage.
45
+	 *
46
+	 * @param string $value
47
+	 */
48
+	public function setPasswordAttribute($value)
49
+	{
50
+		$this->attributes['password'] = bcrypt($value);
51
+	}
52
+
53
+	/**
54
+	 * Get the entity's notifications.
55
+	 */
56
+	public function notifications()
57
+	{
58
+		return $this->morphMany('App\Modules\Notifications\Notification', 'notifiable')->orderBy('created_at', 'desc');
59
+	}
60
+
61
+	/**
62
+	 * Get the entity's read notifications.
63
+	 */
64
+	public function readNotifications()
65
+	{
66
+		return $this->notifications()->whereNotNull('read_at');
67
+	}
68
+
69
+	/**
70
+	 * Get the entity's unread notifications.
71
+	 */
72
+	public function unreadNotifications()
73
+	{
74
+		return $this->notifications()->whereNull('read_at');
75
+	}
76
+
77
+	public function roles()
78
+	{
79
+		return $this->belongsToMany('App\Modules\Roles\Role', 'users_roles', 'user_id', 'role_id')->whereNull('users_roles.deleted_at')->withTimestamps();
80
+	}
81
+
82
+	public function oauthClients()
83
+	{
84
+		return $this->hasMany('App\Modules\OauthClients\OauthClient', 'user_id');
85
+	}
86
+
87
+	/**
88
+	 * Return fcm device tokens that will be used in sending fcm notifications.
89
+	 *
90
+	 * @return array
91
+	 */
92
+	public function routeNotificationForFCM()
93
+	{
94
+		$devices = \Core::pushNotificationDevices()->findBy(['user_id' => $this->id]);
95
+		$tokens  = [];
96
+
97
+		foreach ($devices as $device) {
98
+			if (\Core::users()->accessTokenExpiredOrRevoked($device->access_token)) {
99
+				$device->forceDelete();
100
+				continue;
101
+			}
102
+
103
+			$tokens[] = $device->device_token;
104
+		}
105
+
106
+		return $tokens;
107
+	}
108
+
109
+	/**
110
+	 * The channels the user receives notification broadcasts on.
111
+	 *
112
+	 * @return string
113
+	 */
114
+	public function receivesBroadcastNotificationsOn()
115
+	{
116
+		return 'users.'.$this->id;
117
+	}
118
+
119
+	/**
120
+	 * Custom password validation.
121
+	 *
122
+	 * @param  string $password
123
+	 * @return boolean
124
+	 */
125
+	public function validateForPassportPasswordGrant($password)
126
+	{
127
+		if ($password == config('skeleton.social_pass')) {
128
+			return true;
129
+		}
130
+
131
+		return \Hash::check($password, $this->password);
132
+	}
133 133
     
134
-    public static function boot()
135
-    {
136
-        parent::boot();
137
-        AclUser::observe(\App::make('App\Modules\Users\ModelObservers\AclUserObserver'));
138
-    }
134
+	public static function boot()
135
+	{
136
+		parent::boot();
137
+		AclUser::observe(\App::make('App\Modules\Users\ModelObservers\AclUserObserver'));
138
+	}
139 139
 }
Please login to merge, or discard this patch.
src/Modules/PushNotificationDevices/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', ['pushNotificationDevice']);
17
-        \DB::table('roles_permissions')->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', ['pushNotificationDevice']);
17
+		\DB::table('roles_permissions')->whereIn('permission_id', $permissions->pluck('id'))->delete();
18
+		$permissions->delete();
19
+	}
20 20
 }
Please login to merge, or discard this patch.
Modules/PushNotificationDevices/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', ['pushNotificationDevice'])->each(function ($permission) use ($adminRoleId) {
22
-            \DB::table('roles_permissions')->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', ['pushNotificationDevice'])->each(function ($permission) use ($adminRoleId) {
22
+			\DB::table('roles_permissions')->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', ['pushNotificationDevice'])->each(function ($permission) use ($adminRoleId) {
21
+        \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['pushNotificationDevice'])->each(function($permission) use ($adminRoleId) {
22 22
             \DB::table('roles_permissions')->insert(
23 23
                 [
24 24
                 'permission_id' => $permission->id,
Please login to merge, or discard this patch.
src/Modules/Reporting/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', ['report']);
17
-        \DB::table('roles_permissions')->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', ['report']);
17
+		\DB::table('roles_permissions')->whereIn('permission_id', $permissions->pluck('id'))->delete();
18
+		$permissions->delete();
19
+	}
20 20
 }
Please login to merge, or discard this patch.
src/Modules/Reporting/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', ['report'])->each(function ($permission) use ($adminRoleId) {
22
-            \DB::table('roles_permissions')->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', ['report'])->each(function ($permission) use ($adminRoleId) {
22
+			\DB::table('roles_permissions')->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', ['report'])->each(function ($permission) use ($adminRoleId) {
21
+        \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['report'])->each(function($permission) use ($adminRoleId) {
22 22
             \DB::table('roles_permissions')->insert(
23 23
                 [
24 24
                 'permission_id' => $permission->id,
Please login to merge, or discard this patch.
Modules/Reporting/Database/Migrations/2016_01_19_112603_sampel_report.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -5,14 +5,14 @@  discard block
 block discarded – undo
5 5
 
6 6
 class SampelReport extends Migration
7 7
 {
8
-    /**
9
-     * Run the migrations.
10
-     *
11
-     * @return void
12
-     */
13
-    public function up()
14
-    {
15
-        DB::statement("CREATE VIEW admin_count AS  
8
+	/**
9
+	 * Run the migrations.
10
+	 *
11
+	 * @return void
12
+	 */
13
+	public function up()
14
+	{
15
+		DB::statement("CREATE VIEW admin_count AS  
16 16
 			select count(u.id)
17 17
 			from users u, roles g ,users_roles ug
18 18
 			where
@@ -20,25 +20,25 @@  discard block
 block discarded – undo
20 20
 			ug.role_id = g.id 
21 21
 			");
22 22
         
23
-        DB::table('reports')->insert(
24
-            [
25
-                [
26
-                'report_name' => 'admin_count',
27
-                'view_name'   => 'admin_count',
28
-                'created_at'  => \DB::raw('NOW()'),
29
-                'updated_at'  => \DB::raw('NOW()')
30
-                ]
31
-            ]
32
-        );
33
-    }
23
+		DB::table('reports')->insert(
24
+			[
25
+				[
26
+				'report_name' => 'admin_count',
27
+				'view_name'   => 'admin_count',
28
+				'created_at'  => \DB::raw('NOW()'),
29
+				'updated_at'  => \DB::raw('NOW()')
30
+				]
31
+			]
32
+		);
33
+	}
34 34
 
35
-    /**
36
-     * Reverse the migrations.
37
-     *
38
-     * @return void
39
-     */
40
-    public function down()
41
-    {
42
-        DB::statement("DROP VIEW IF EXISTS admin_count");
43
-    }
35
+	/**
36
+	 * Reverse the migrations.
37
+	 *
38
+	 * @return void
39
+	 */
40
+	public function down()
41
+	{
42
+		DB::statement("DROP VIEW IF EXISTS admin_count");
43
+	}
44 44
 }
Please login to merge, or discard this patch.
src/Modules/Permissions/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', ['permission']);
17
-        \DB::table('roles_permissions')->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', ['permission']);
17
+		\DB::table('roles_permissions')->whereIn('permission_id', $permissions->pluck('id'))->delete();
18
+		$permissions->delete();
19
+	}
20 20
 }
Please login to merge, or discard this patch.
src/Modules/Permissions/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', ['permission'])->each(function ($permission) use ($adminRoleId) {
22
-            \DB::table('roles_permissions')->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', ['permission'])->each(function ($permission) use ($adminRoleId) {
22
+			\DB::table('roles_permissions')->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', ['permission'])->each(function ($permission) use ($adminRoleId) {
21
+        \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['permission'])->each(function($permission) use ($adminRoleId) {
22 22
             \DB::table('roles_permissions')->insert(
23 23
                 [
24 24
                 'permission_id' => $permission->id,
Please login to merge, or discard this patch.
src/Modules/Permissions/Database/Factories/PermissionFactory.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 $factory->define(App\Modules\Permissions\Permission::class, function (Faker\Generator $faker) {
4
-    return [
5
-        'name'       => $faker->randomElement(['save', 'delete', 'find', 'paginate']),
6
-        'model'      => $faker->randomElement(['users', 'roles', 'settings', 'notifications']),
7
-        'created_at' => $faker->dateTimeBetween('-1 years', 'now'),
8
-        'updated_at' => $faker->dateTimeBetween('-1 years', 'now')
9
-    ];
4
+	return [
5
+		'name'       => $faker->randomElement(['save', 'delete', 'find', 'paginate']),
6
+		'model'      => $faker->randomElement(['users', 'roles', 'settings', 'notifications']),
7
+		'created_at' => $faker->dateTimeBetween('-1 years', 'now'),
8
+		'updated_at' => $faker->dateTimeBetween('-1 years', 'now')
9
+	];
10 10
 });
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-$factory->define(App\Modules\Permissions\Permission::class, function (Faker\Generator $faker) {
3
+$factory->define(App\Modules\Permissions\Permission::class, function(Faker\Generator $faker) {
4 4
     return [
5 5
         'name'       => $faker->randomElement(['save', 'delete', 'find', 'paginate']),
6 6
         'model'      => $faker->randomElement(['users', 'roles', 'settings', 'notifications']),
Please login to merge, or discard this patch.