Completed
Push — master ( 2e36c4...3a8db8 )
by Sherif
02:08
created
src/Modules/Core/Interfaces/BaseRepositoryInterface.php 1 patch
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -2,107 +2,107 @@
 block discarded – undo
2 2
 
3 3
 interface BaseRepositoryInterface
4 4
 {
5
-    /**
6
-     * Fetch all records with relations from the storage.
7
-     *
8
-     * @param  array  $relations
9
-     * @param  array  $sortBy
10
-     * @param  array  $desc
11
-     * @param  array  $columns
12
-     * @return collection
13
-     */
14
-    public function all($relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*'));
5
+	/**
6
+	 * Fetch all records with relations from the storage.
7
+	 *
8
+	 * @param  array  $relations
9
+	 * @param  array  $sortBy
10
+	 * @param  array  $desc
11
+	 * @param  array  $columns
12
+	 * @return collection
13
+	 */
14
+	public function all($relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*'));
15 15
     
16
-    /**
17
-     * Fetch all records with relations from storage in pages
18
-     * that matche the given query.
19
-     *
20
-     * @param  string  $query
21
-     * @param  integer $perPage
22
-     * @param  array   $relations
23
-     * @param  array   $sortBy
24
-     * @param  array   $desc
25
-     * @param  array   $columns
26
-     * @return collection
27
-     */
28
-    public function search($query, $perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*'));
16
+	/**
17
+	 * Fetch all records with relations from storage in pages
18
+	 * that matche the given query.
19
+	 *
20
+	 * @param  string  $query
21
+	 * @param  integer $perPage
22
+	 * @param  array   $relations
23
+	 * @param  array   $sortBy
24
+	 * @param  array   $desc
25
+	 * @param  array   $columns
26
+	 * @return collection
27
+	 */
28
+	public function search($query, $perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*'));
29 29
 
30
-    /**
31
-     * Fetch all records with relations from storage in pages.
32
-     *
33
-     * @param  integer $perPage
34
-     * @param  array   $relations
35
-     * @param  array   $sortBy
36
-     * @param  array   $desc
37
-     * @param  array   $columns
38
-     * @return collection
39
-     */
40
-    public function paginate($perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*'));
30
+	/**
31
+	 * Fetch all records with relations from storage in pages.
32
+	 *
33
+	 * @param  integer $perPage
34
+	 * @param  array   $relations
35
+	 * @param  array   $sortBy
36
+	 * @param  array   $desc
37
+	 * @param  array   $columns
38
+	 * @return collection
39
+	 */
40
+	public function paginate($perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*'));
41 41
     
42
-    /**
43
-     * Fetch all records with relations based on
44
-     * the given condition from storage in pages.
45
-     *
46
-     * @param  array   $conditions array of conditions
47
-     * @param  integer $perPage
48
-     * @param  array   $relations
49
-     * @param  array   $sortBy
50
-     * @param  array   $desc
51
-     * @param  array   $columns
52
-     * @return collection
53
-     */
54
-    public function paginateBy($conditions, $perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*'));
42
+	/**
43
+	 * Fetch all records with relations based on
44
+	 * the given condition from storage in pages.
45
+	 *
46
+	 * @param  array   $conditions array of conditions
47
+	 * @param  integer $perPage
48
+	 * @param  array   $relations
49
+	 * @param  array   $sortBy
50
+	 * @param  array   $desc
51
+	 * @param  array   $columns
52
+	 * @return collection
53
+	 */
54
+	public function paginateBy($conditions, $perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*'));
55 55
 
56
-     /**
57
-      * Save the given model/models to the storage.
58
-      *
59
-      * @param  array $data
60
-      * @return mixed
61
-      */
62
-    public function save(array $data);
56
+	 /**
57
+	  * Save the given model/models to the storage.
58
+	  *
59
+	  * @param  array $data
60
+	  * @return mixed
61
+	  */
62
+	public function save(array $data);
63 63
 
64
-    /**
65
-     * Delete record from the storage based on the given
66
-     * condition.
67
-     *
68
-     * @param  var     $value condition value
69
-     * @param  string  $attribute condition column name
70
-     * @return integer affected rows
71
-     */
72
-    public function delete($value, $attribute = 'id');
64
+	/**
65
+	 * Delete record from the storage based on the given
66
+	 * condition.
67
+	 *
68
+	 * @param  var     $value condition value
69
+	 * @param  string  $attribute condition column name
70
+	 * @return integer affected rows
71
+	 */
72
+	public function delete($value, $attribute = 'id');
73 73
     
74
-    /**
75
-     * Fetch records from the storage based on the given
76
-     * id.
77
-     *
78
-     * @param  integer $id
79
-     * @param  array   $relations
80
-     * @param  array   $columns
81
-     * @return object
82
-     */
83
-    public function find($id, $relations = [], $columns = array('*'));
74
+	/**
75
+	 * Fetch records from the storage based on the given
76
+	 * id.
77
+	 *
78
+	 * @param  integer $id
79
+	 * @param  array   $relations
80
+	 * @param  array   $columns
81
+	 * @return object
82
+	 */
83
+	public function find($id, $relations = [], $columns = array('*'));
84 84
     
85
-    /**
86
-     * Fetch records from the storage based on the given
87
-     * condition.
88
-     *
89
-     * @param  array   $conditions array of conditions
90
-     * @param  array   $relations
91
-     * @param  array   $sortBy
92
-     * @param  array   $desc
93
-     * @param  array   $columns
94
-     * @return collection
95
-     */
96
-    public function findBy($conditions, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*'));
85
+	/**
86
+	 * Fetch records from the storage based on the given
87
+	 * condition.
88
+	 *
89
+	 * @param  array   $conditions array of conditions
90
+	 * @param  array   $relations
91
+	 * @param  array   $sortBy
92
+	 * @param  array   $desc
93
+	 * @param  array   $columns
94
+	 * @return collection
95
+	 */
96
+	public function findBy($conditions, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*'));
97 97
 
98
-    /**
99
-     * Fetch the first record fro the storage based on the given
100
-     * condition.
101
-     *
102
-     * @param  array   $conditions array of conditions
103
-     * @param  array   $relations
104
-     * @param  array   $columns
105
-     * @return object
106
-     */
107
-    public function first($conditions, $relations = [], $columns = array('*'));
98
+	/**
99
+	 * Fetch the first record fro the storage based on the given
100
+	 * condition.
101
+	 *
102
+	 * @param  array   $conditions array of conditions
103
+	 * @param  array   $relations
104
+	 * @param  array   $columns
105
+	 * @return object
106
+	 */
107
+	public function first($conditions, $relations = [], $columns = array('*'));
108 108
 }
Please login to merge, or discard this patch.
src/Modules/Core/Http/Resources/General.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -6,14 +6,14 @@
 block discarded – undo
6 6
 
7 7
 class General extends JsonResource
8 8
 {
9
-    /**
10
-     * Transform the resource into an array.
11
-     *
12
-     * @param Request $request
13
-     * @return array
14
-     */
15
-    public function toArray($request)
16
-    {
17
-        return ['status' => $this->resource ?? 'success'];
18
-    }
9
+	/**
10
+	 * Transform the resource into an array.
11
+	 *
12
+	 * @param Request $request
13
+	 * @return array
14
+	 */
15
+	public function toArray($request)
16
+	{
17
+		return ['status' => $this->resource ?? 'success'];
18
+	}
19 19
 }
Please login to merge, or discard this patch.
src/Modules/Core/Http/Requests/UpdateSetting.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -6,26 +6,26 @@
 block discarded – undo
6 6
 
7 7
 class UpdateSetting extends FormRequest
8 8
 {
9
-    /**
10
-     * Determine if the user is authorized to make this request.
11
-     *
12
-     * @return bool
13
-     */
14
-    public function authorize()
15
-    {
16
-        return true;
17
-    }
9
+	/**
10
+	 * Determine if the user is authorized to make this request.
11
+	 *
12
+	 * @return bool
13
+	 */
14
+	public function authorize()
15
+	{
16
+		return true;
17
+	}
18 18
 
19
-    /**
20
-     * Get the validation rules that apply to the request.
21
-     *
22
-     * @return array
23
-     */
24
-    public function rules()
25
-    {
26
-        return [
27
-            'id'    => 'required|exists:settings,id',
28
-            'value' => 'required|string'
29
-        ];
30
-    }
19
+	/**
20
+	 * Get the validation rules that apply to the request.
21
+	 *
22
+	 * @return array
23
+	 */
24
+	public function rules()
25
+	{
26
+		return [
27
+			'id'    => 'required|exists:settings,id',
28
+			'value' => 'required|string'
29
+		];
30
+	}
31 31
 }
Please login to merge, or discard this patch.
src/Modules/Core/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', ['setting'])->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', ['setting'])->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', ['setting'])->each(function ($permission) use ($adminGroupId) {
21
+        \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['setting'])->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.
src/Modules/Core/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', ['setting']);
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', ['setting']);
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.
src/Modules/Core/Database/Seeds/SettingsTableSeeder.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -6,52 +6,52 @@
 block discarded – undo
6 6
 
7 7
 class SettingsTableSeeder extends Seeder
8 8
 {
9
-    /**
10
-     * Run the database seeds.
11
-     *
12
-     * @return void
13
-     */
14
-    public function run()
15
-    {
16
-        /**
17
-         * Insert the permissions related to settings table.
18
-         */
19
-        \DB::table('permissions')->insert(
20
-            [
21
-                /**
22
-                 * Settings model permissions.
23
-                 */
24
-                [
25
-                'name'       => 'index',
26
-                'model'      => 'setting',
27
-                'created_at' => \DB::raw('NOW()'),
28
-                'updated_at' => \DB::raw('NOW()')
29
-                ],
30
-                [
31
-                'name'       => 'find',
32
-                'model'      => 'setting',
33
-                'created_at' => \DB::raw('NOW()'),
34
-                'updated_at' => \DB::raw('NOW()')
35
-                ],
36
-                [
37
-                'name'       => 'update',
38
-                'model'      => 'setting',
39
-                'created_at' => \DB::raw('NOW()'),
40
-                'updated_at' => \DB::raw('NOW()')
41
-                ],
42
-                [
43
-                'name'       => 'delete',
44
-                'model'      => 'setting',
45
-                'created_at' => \DB::raw('NOW()'),
46
-                'updated_at' => \DB::raw('NOW()')
47
-                ],
48
-                [
49
-                'name'       => 'saveMany',
50
-                'model'      => 'setting',
51
-                'created_at' => \DB::raw('NOW()'),
52
-                'updated_at' => \DB::raw('NOW()')
53
-                ]
54
-            ]
55
-        );
56
-    }
9
+	/**
10
+	 * Run the database seeds.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function run()
15
+	{
16
+		/**
17
+		 * Insert the permissions related to settings table.
18
+		 */
19
+		\DB::table('permissions')->insert(
20
+			[
21
+				/**
22
+				 * Settings model permissions.
23
+				 */
24
+				[
25
+				'name'       => 'index',
26
+				'model'      => 'setting',
27
+				'created_at' => \DB::raw('NOW()'),
28
+				'updated_at' => \DB::raw('NOW()')
29
+				],
30
+				[
31
+				'name'       => 'find',
32
+				'model'      => 'setting',
33
+				'created_at' => \DB::raw('NOW()'),
34
+				'updated_at' => \DB::raw('NOW()')
35
+				],
36
+				[
37
+				'name'       => 'update',
38
+				'model'      => 'setting',
39
+				'created_at' => \DB::raw('NOW()'),
40
+				'updated_at' => \DB::raw('NOW()')
41
+				],
42
+				[
43
+				'name'       => 'delete',
44
+				'model'      => 'setting',
45
+				'created_at' => \DB::raw('NOW()'),
46
+				'updated_at' => \DB::raw('NOW()')
47
+				],
48
+				[
49
+				'name'       => 'saveMany',
50
+				'model'      => 'setting',
51
+				'created_at' => \DB::raw('NOW()'),
52
+				'updated_at' => \DB::raw('NOW()')
53
+				]
54
+			]
55
+		);
56
+	}
57 57
 }
Please login to merge, or discard this patch.
src/Modules/Groups/Routes/api.php 3 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,5 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-use Illuminate\Http\Request;
4
-
5 3
 /*
6 4
 |--------------------------------------------------------------------------
7 5
 | API Routes
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 |
14 14
 */
15 15
 
16
-Route::group(['prefix' => 'groups'], function () {
16
+Route::group(['prefix' => 'groups'], function() {
17 17
 
18 18
     Route::get('/', 'GroupController@index');
19 19
     Route::get('/{id}', 'GroupController@find');
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,12 +15,12 @@
 block discarded – undo
15 15
 
16 16
 Route::group(['prefix' => 'groups'], function () {
17 17
 
18
-    Route::get('/', 'GroupController@index');
19
-    Route::get('/{id}', 'GroupController@find');
20
-    Route::post('/', 'GroupController@insert');
21
-    Route::put('/', 'GroupController@update');
22
-    Route::delete('/{id}', 'GroupController@delete');
23
-    Route::get('list/deleted', 'GroupController@deleted');
24
-    Route::patch('restore/{id}', 'GroupController@restore');
25
-    Route::post('assign/permissions', 'GroupController@assignPermissions');
18
+	Route::get('/', 'GroupController@index');
19
+	Route::get('/{id}', 'GroupController@find');
20
+	Route::post('/', 'GroupController@insert');
21
+	Route::put('/', 'GroupController@update');
22
+	Route::delete('/{id}', 'GroupController@delete');
23
+	Route::get('list/deleted', 'GroupController@deleted');
24
+	Route::patch('restore/{id}', 'GroupController@restore');
25
+	Route::post('assign/permissions', 'GroupController@assignPermissions');
26 26
 });
Please login to merge, or discard this patch.
src/Modules/Permissions/Routes/api.php 3 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,5 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-use Illuminate\Http\Request;
4
-
5 3
 /*
6 4
 |--------------------------------------------------------------------------
7 5
 | API Routes
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 |
14 14
 */
15 15
 
16
-Route::group(['prefix' => 'permissions'], function () {
16
+Route::group(['prefix' => 'permissions'], function() {
17 17
         
18 18
     Route::get('/', 'PermissionController@index');
19 19
     Route::get('/{id}', 'PermissionController@find');
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,6 +15,6 @@
 block discarded – undo
15 15
 
16 16
 Route::group(['prefix' => 'permissions'], function () {
17 17
         
18
-    Route::get('/', 'PermissionController@index');
19
-    Route::get('/{id}', 'PermissionController@find');
18
+	Route::get('/', 'PermissionController@index');
19
+	Route::get('/{id}', 'PermissionController@find');
20 20
 });
Please login to merge, or discard this patch.
PushNotificationDevices/Repositories/PushNotificationDeviceRepository.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
      * Register the given device to the logged in user.
22 22
      *
23 23
      * @param  array $data
24
-     * @return void
24
+     * @return boolean
25 25
      */
26 26
     public function registerDevice($data)
27 27
     {
Please login to merge, or discard this patch.
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -8,60 +8,60 @@
 block discarded – undo
8 8
 
9 9
 class PushNotificationDeviceRepository extends BaseRepository
10 10
 {
11
-    /**
12
-     * Init new object.
13
-     *
14
-     * @param   PushNotificationDevice $model
15
-     * @return  void
16
-     */
17
-    public function __construct(PushNotificationDevice $model)
18
-    {
19
-        parent::__construct($model);
20
-    }
11
+	/**
12
+	 * Init new object.
13
+	 *
14
+	 * @param   PushNotificationDevice $model
15
+	 * @return  void
16
+	 */
17
+	public function __construct(PushNotificationDevice $model)
18
+	{
19
+		parent::__construct($model);
20
+	}
21 21
 
22
-    /**
23
-     * Register the given device to the logged in user.
24
-     *
25
-     * @param  array $data
26
-     * @return void
27
-     */
28
-    public function registerDevice($data)
29
-    {
30
-        $data['access_token'] = \Auth::user()->token();
31
-        $data['user_id']      = \Auth::id();
32
-        $device               = $this->model->where('device_token', $data['device_token'])->
33
-                                              where('user_id', $data['user_id'])->
34
-                                              first();
22
+	/**
23
+	 * Register the given device to the logged in user.
24
+	 *
25
+	 * @param  array $data
26
+	 * @return void
27
+	 */
28
+	public function registerDevice($data)
29
+	{
30
+		$data['access_token'] = \Auth::user()->token();
31
+		$data['user_id']      = \Auth::id();
32
+		$device               = $this->model->where('device_token', $data['device_token'])->
33
+											  where('user_id', $data['user_id'])->
34
+											  first();
35 35
 
36
-        if ($device) {
37
-            $data['id'] = $device->id;
38
-        }
36
+		if ($device) {
37
+			$data['id'] = $device->id;
38
+		}
39 39
 
40
-        return $this->save($data);
41
-    }
40
+		return $this->save($data);
41
+	}
42 42
 
43
-    /**
44
-     * Generate the given message data.
45
-     *
46
-     * @param  string $title
47
-     * @param  string $message
48
-     * @param  array  $data
49
-     * @return void
50
-     */
51
-    public function generateMessageData($title, $message, $data = [])
52
-    {
53
-        $optionBuilder       = new OptionsBuilder();
54
-        $notificationBuilder = new PayloadNotificationBuilder($title);
55
-        $dataBuilder         = new PayloadDataBuilder();
43
+	/**
44
+	 * Generate the given message data.
45
+	 *
46
+	 * @param  string $title
47
+	 * @param  string $message
48
+	 * @param  array  $data
49
+	 * @return void
50
+	 */
51
+	public function generateMessageData($title, $message, $data = [])
52
+	{
53
+		$optionBuilder       = new OptionsBuilder();
54
+		$notificationBuilder = new PayloadNotificationBuilder($title);
55
+		$dataBuilder         = new PayloadDataBuilder();
56 56
 
57
-        $optionBuilder->setTimeToLive(60 * 20);
58
-        $notificationBuilder->setBody($message);
59
-        $dataBuilder->addData($data);
57
+		$optionBuilder->setTimeToLive(60 * 20);
58
+		$notificationBuilder->setBody($message);
59
+		$dataBuilder->addData($data);
60 60
 
61
-        $options             = $optionBuilder->build();
62
-        $notification        = $notificationBuilder->build();
63
-        $data                = $dataBuilder->build();
61
+		$options             = $optionBuilder->build();
62
+		$notification        = $notificationBuilder->build();
63
+		$data                = $dataBuilder->build();
64 64
 
65
-        return compact('options', 'notification', 'data');
66
-    }
65
+		return compact('options', 'notification', 'data');
66
+	}
67 67
 }
Please login to merge, or discard this patch.