Completed
Push — master ( ec2395...0dfd17 )
by Sherif
02:09
created
Database/Factories/PushNotificationDeviceFactory.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\PushNotificationDevices\PushNotificationDevice::class, function (Faker\Generator $faker) {
4
-    return [
5
-        'device_token' => $faker->sha1(),
6
-        'user_id'      => $faker->randomDigitNotNull(),
7
-        'created_at'   => $faker->dateTimeBetween('-1 years', 'now'),
8
-        'updated_at'   => $faker->dateTimeBetween('-1 years', 'now')
9
-    ];
4
+	return [
5
+		'device_token' => $faker->sha1(),
6
+		'user_id'      => $faker->randomDigitNotNull(),
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\PushNotificationDevices\PushNotificationDevice::class, function (Faker\Generator $faker) {
3
+$factory->define(App\Modules\PushNotificationDevices\PushNotificationDevice::class, function(Faker\Generator $faker) {
4 4
     return [
5 5
         'device_token' => $faker->sha1(),
6 6
         'user_id'      => $faker->randomDigitNotNull(),
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
-        $adminGroupId = \DB::table('groups')->where('name', 'admin')->select('id')->first()->id;
9
+	/**
10
+	 * Run the database seeds.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function run()
15
+	{
16
+		$adminGroupId = \DB::table('groups')->where('name', 'admin')->select('id')->first()->id;
17 17
 
18
-        /**
19
-         * Assign the permissions to the admin group.
20
-         */
21
-        \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['pushNotificationDevice'])->each(function ($permission) use ($adminGroupId) {
22
-            \DB::table('groups_permissions')->insert(
23
-                [
24
-                'permission_id' => $permission->id,
25
-                'group_id'      => $adminGroupId,
26
-                'created_at'    => \DB::raw('NOW()'),
27
-                'updated_at'    => \DB::raw('NOW()')
28
-                ]
29
-            );
30
-        });
31
-    }
18
+		/**
19
+		 * Assign the permissions to the admin group.
20
+		 */
21
+		\DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['pushNotificationDevice'])->each(function ($permission) use ($adminGroupId) {
22
+			\DB::table('groups_permissions')->insert(
23
+				[
24
+				'permission_id' => $permission->id,
25
+				'group_id'      => $adminGroupId,
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 group.
20 20
          */
21
-        \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['pushNotificationDevice'])->each(function ($permission) use ($adminGroupId) {
21
+        \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['pushNotificationDevice'])->each(function($permission) use ($adminGroupId) {
22 22
             \DB::table('groups_permissions')->insert(
23 23
                 [
24 24
                 'permission_id' => $permission->id,
Please login to merge, or discard this patch.
Database/Seeds/PushNotificationDevicesDatabaseSeeder.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 PushNotificationDevicesDatabaseSeeder extends Seeder
8 8
 {
9
-    /**
10
-     * Run the database seeds.
11
-     *
12
-     * @return void
13
-     */
14
-    public function run()
15
-    {
16
-        $this->call(ClearDataSeeder::class);
17
-        $this->call(PushNotificationDevicesTableSeeder::class);
18
-        $this->call(AssignRelationsSeeder::class);
19
-    }
9
+	/**
10
+	 * Run the database seeds.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function run()
15
+	{
16
+		$this->call(ClearDataSeeder::class);
17
+		$this->call(PushNotificationDevicesTableSeeder::class);
18
+		$this->call(AssignRelationsSeeder::class);
19
+	}
20 20
 }
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('groups_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('groups_permissions')->whereIn('permission_id', $permissions->pluck('id'))->delete();
18
+		$permissions->delete();
19
+	}
20 20
 }
Please login to merge, or discard this patch.
Modules/PushNotificationDevices/Http/Resources/PushNotificationDevice.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -7,25 +7,25 @@
 block discarded – undo
7 7
 
8 8
 class PushNotificationDevice extends JsonResource
9 9
 {
10
-    /**
11
-     * Transform the resource into an array.
12
-     *
13
-     * @param Request $request
14
-     * @return array
15
-     */
16
-    public function toArray($request)
17
-    {
18
-        if (! $this->resource) {
19
-            return [];
20
-        }
10
+	/**
11
+	 * Transform the resource into an array.
12
+	 *
13
+	 * @param Request $request
14
+	 * @return array
15
+	 */
16
+	public function toArray($request)
17
+	{
18
+		if (! $this->resource) {
19
+			return [];
20
+		}
21 21
 
22
-        return [
23
-            'id' => $this->id,
24
-            'device_token' => $this->device_token,
25
-            'access_token' => $this->access_token,
26
-            'user' => new UserResource($this->whenLoaded('user')),
27
-            'created_at' => $this->created_at,
28
-            'updated_at' => $this->updated_at,
29
-        ];
30
-    }
22
+		return [
23
+			'id' => $this->id,
24
+			'device_token' => $this->device_token,
25
+			'access_token' => $this->access_token,
26
+			'user' => new UserResource($this->whenLoaded('user')),
27
+			'created_at' => $this->created_at,
28
+			'updated_at' => $this->updated_at,
29
+		];
30
+	}
31 31
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
      */
16 16
     public function toArray($request)
17 17
     {
18
-        if (! $this->resource) {
18
+        if ( ! $this->resource) {
19 19
             return [];
20 20
         }
21 21
 
Please login to merge, or discard this patch.
Http/Controllers/PushNotificationDeviceController.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -11,55 +11,55 @@
 block discarded – undo
11 11
 
12 12
 class PushNotificationDeviceController extends BaseApiController
13 13
 {
14
-    /**
15
-     * List of all route actions that the base api controller
16
-     * will skip permissions check for them.
17
-     * @var array
18
-     */
19
-    protected $skipPermissionCheck = ['registerDevice'];
14
+	/**
15
+	 * List of all route actions that the base api controller
16
+	 * will skip permissions check for them.
17
+	 * @var array
18
+	 */
19
+	protected $skipPermissionCheck = ['registerDevice'];
20 20
 
21
-    /**
22
-     * Init new object.
23
-     *
24
-     * @param   PushNotificationDeviceRepository $repo
25
-     * @param   CoreConfig                       $config
26
-     * @return  void
27
-     */
28
-    public function __construct(PushNotificationDeviceRepository $repo, CoreConfig $config)
29
-    {
30
-        parent::__construct($repo, $config, 'App\Modules\PushNotificationDevices\Http\Resources\PushNotificationDevice');
31
-    }
21
+	/**
22
+	 * Init new object.
23
+	 *
24
+	 * @param   PushNotificationDeviceRepository $repo
25
+	 * @param   CoreConfig                       $config
26
+	 * @return  void
27
+	 */
28
+	public function __construct(PushNotificationDeviceRepository $repo, CoreConfig $config)
29
+	{
30
+		parent::__construct($repo, $config, 'App\Modules\PushNotificationDevices\Http\Resources\PushNotificationDevice');
31
+	}
32 32
 
33
-    /**
34
-     * Insert the given model to storage.
35
-     *
36
-     * @param InsertPushNotificationDevice $request
37
-     * @return \Illuminate\Http\Response
38
-     */
39
-    public function insert(InsertPushNotificationDevice $request)
40
-    {
41
-        return new $this->modelResource($this->repo->save($request->all()));
42
-    }
33
+	/**
34
+	 * Insert the given model to storage.
35
+	 *
36
+	 * @param InsertPushNotificationDevice $request
37
+	 * @return \Illuminate\Http\Response
38
+	 */
39
+	public function insert(InsertPushNotificationDevice $request)
40
+	{
41
+		return new $this->modelResource($this->repo->save($request->all()));
42
+	}
43 43
 
44
-    /**
45
-     * Update the given model to storage.
46
-     *
47
-     * @param UpdatePushNotificationDevice $request
48
-     * @return \Illuminate\Http\Response
49
-     */
50
-    public function update(UpdatePushNotificationDevice $request)
51
-    {
52
-        return new $this->modelResource($this->repo->save($request->all()));
53
-    }
44
+	/**
45
+	 * Update the given model to storage.
46
+	 *
47
+	 * @param UpdatePushNotificationDevice $request
48
+	 * @return \Illuminate\Http\Response
49
+	 */
50
+	public function update(UpdatePushNotificationDevice $request)
51
+	{
52
+		return new $this->modelResource($this->repo->save($request->all()));
53
+	}
54 54
 
55
-    /**
56
-     * Register the given device to the logged in user.
57
-     *
58
-     * @param RegisterDevice $request
59
-     * @return \Illuminate\Http\Response
60
-     */
61
-    public function registerDevice(RegisterDevice $request)
62
-    {
63
-        return new $this->modelResource($this->repo->registerDevice($request->all()));
64
-    }
55
+	/**
56
+	 * Register the given device to the logged in user.
57
+	 *
58
+	 * @param RegisterDevice $request
59
+	 * @return \Illuminate\Http\Response
60
+	 */
61
+	public function registerDevice(RegisterDevice $request)
62
+	{
63
+		return new $this->modelResource($this->repo->registerDevice($request->all()));
64
+	}
65 65
 }
Please login to merge, or discard this patch.
src/Modules/PushNotificationDevices/PushNotificationDevice.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -6,48 +6,48 @@
 block discarded – undo
6 6
 class PushNotificationDevice extends Model
7 7
 {
8 8
 
9
-    use SoftDeletes;
10
-    protected $table    = 'push_notifications_devices';
11
-    protected $dates    = ['created_at', 'updated_at', 'deleted_at'];
12
-    protected $hidden   = ['deleted_at', 'access_token'];
13
-    protected $guarded  = ['id'];
14
-    protected $fillable = ['device_token', 'user_id', 'access_token'];
15
-    public $searchable  = ['device_token'];
16
-
17
-    public function getCreatedAtAttribute($value)
18
-    {
19
-        return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
20
-    }
21
-
22
-    public function getUpdatedAtAttribute($value)
23
-    {
24
-        return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
25
-    }
26
-
27
-    public function getDeletedAtAttribute($value)
28
-    {
29
-        return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
30
-    }
9
+	use SoftDeletes;
10
+	protected $table    = 'push_notifications_devices';
11
+	protected $dates    = ['created_at', 'updated_at', 'deleted_at'];
12
+	protected $hidden   = ['deleted_at', 'access_token'];
13
+	protected $guarded  = ['id'];
14
+	protected $fillable = ['device_token', 'user_id', 'access_token'];
15
+	public $searchable  = ['device_token'];
16
+
17
+	public function getCreatedAtAttribute($value)
18
+	{
19
+		return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
20
+	}
21
+
22
+	public function getUpdatedAtAttribute($value)
23
+	{
24
+		return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
25
+	}
26
+
27
+	public function getDeletedAtAttribute($value)
28
+	{
29
+		return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
30
+	}
31 31
     
32
-    public function user()
33
-    {
34
-        return $this->belongsTo('App\Modules\Users\AclUser');
35
-    }
36
-
37
-    /**
38
-     * Encrypt the access_token attribute before
39
-     * saving it in the storage.
40
-     *
41
-     * @param string $value
42
-     */
43
-    public function setLoginTokenAttribute($value)
44
-    {
45
-        $this->attributes['access_token'] = encrypt($value);
46
-    }
47
-
48
-    public static function boot()
49
-    {
50
-        parent::boot();
51
-        PushNotificationDevice::observe(\App::make('App\Modules\PushNotificationDevices\ModelObservers\PushNotificationDeviceObserver'));
52
-    }
32
+	public function user()
33
+	{
34
+		return $this->belongsTo('App\Modules\Users\AclUser');
35
+	}
36
+
37
+	/**
38
+	 * Encrypt the access_token attribute before
39
+	 * saving it in the storage.
40
+	 *
41
+	 * @param string $value
42
+	 */
43
+	public function setLoginTokenAttribute($value)
44
+	{
45
+		$this->attributes['access_token'] = encrypt($value);
46
+	}
47
+
48
+	public static function boot()
49
+	{
50
+		parent::boot();
51
+		PushNotificationDevice::observe(\App::make('App\Modules\PushNotificationDevices\ModelObservers\PushNotificationDeviceObserver'));
52
+	}
53 53
 }
Please login to merge, or discard this patch.
src/Modules/Permissions/AclPermission.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -6,37 +6,37 @@
 block discarded – undo
6 6
 class AclPermission extends Model
7 7
 {
8 8
 
9
-    use SoftDeletes;
10
-    protected $table    = 'permissions';
11
-    protected $dates    = ['created_at', 'updated_at', 'deleted_at'];
12
-    protected $hidden   = ['deleted_at'];
13
-    protected $guarded  = ['id'];
14
-    protected $fillable = ['name', 'model'];
15
-    public $searchable  = ['name', 'model'];
9
+	use SoftDeletes;
10
+	protected $table    = 'permissions';
11
+	protected $dates    = ['created_at', 'updated_at', 'deleted_at'];
12
+	protected $hidden   = ['deleted_at'];
13
+	protected $guarded  = ['id'];
14
+	protected $fillable = ['name', 'model'];
15
+	public $searchable  = ['name', 'model'];
16 16
 
17
-    public function getCreatedAtAttribute($value)
18
-    {
19
-        return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
20
-    }
17
+	public function getCreatedAtAttribute($value)
18
+	{
19
+		return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
20
+	}
21 21
 
22
-    public function getUpdatedAtAttribute($value)
23
-    {
24
-        return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
25
-    }
22
+	public function getUpdatedAtAttribute($value)
23
+	{
24
+		return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
25
+	}
26 26
 
27
-    public function getDeletedAtAttribute($value)
28
-    {
29
-        return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
30
-    }
27
+	public function getDeletedAtAttribute($value)
28
+	{
29
+		return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString();
30
+	}
31 31
     
32
-    public function groups()
33
-    {
34
-        return $this->belongsToMany('App\Modules\Groups\AclGroup', 'groups_permissions', 'permission_id', 'group_id')->whereNull('groups_permissions.deleted_at')->withTimestamps();
35
-    }
32
+	public function groups()
33
+	{
34
+		return $this->belongsToMany('App\Modules\Groups\AclGroup', 'groups_permissions', 'permission_id', 'group_id')->whereNull('groups_permissions.deleted_at')->withTimestamps();
35
+	}
36 36
 
37
-    public static function boot()
38
-    {
39
-        parent::boot();
40
-        AclPermission::observe(\App::make('App\Modules\Permissions\ModelObservers\AclPermissionObserver'));
41
-    }
37
+	public static function boot()
38
+	{
39
+		parent::boot();
40
+		AclPermission::observe(\App::make('App\Modules\Permissions\ModelObservers\AclPermissionObserver'));
41
+	}
42 42
 }
Please login to merge, or discard this patch.
src/Modules/Permissions/Providers/ModuleServiceProvider.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -6,27 +6,27 @@
 block discarded – undo
6 6
 
7 7
 class ModuleServiceProvider extends ServiceProvider
8 8
 {
9
-    /**
10
-     * Bootstrap the module services.
11
-     *
12
-     * @return void
13
-     */
14
-    public function boot()
15
-    {
16
-        $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'permissions');
17
-        $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'permissions');
9
+	/**
10
+	 * Bootstrap the module services.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function boot()
15
+	{
16
+		$this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'permissions');
17
+		$this->loadViewsFrom(__DIR__.'/../Resources/Views', 'permissions');
18 18
 
19
-        $this->loadMigrationsFrom(module_path('permissions', 'Database/Migrations', 'app'));
20
-        $this->loadFactoriesFrom(module_path('permissions', 'Database/Factories', 'app'));
21
-    }
19
+		$this->loadMigrationsFrom(module_path('permissions', 'Database/Migrations', 'app'));
20
+		$this->loadFactoriesFrom(module_path('permissions', 'Database/Factories', 'app'));
21
+	}
22 22
 
23
-    /**
24
-     * Register the module services.
25
-     *
26
-     * @return void
27
-     */
28
-    public function register()
29
-    {
30
-        $this->app->register(RouteServiceProvider::class);
31
-    }
23
+	/**
24
+	 * Register the module services.
25
+	 *
26
+	 * @return void
27
+	 */
28
+	public function register()
29
+	{
30
+		$this->app->register(RouteServiceProvider::class);
31
+	}
32 32
 }
Please login to merge, or discard this patch.