Completed
Push — master ( 8df45b...9d0042 )
by Sherif
02:28 queued 11s
created
src/Modules/Core/Interfaces/BaseFactoryInterface.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -2,15 +2,15 @@
 block discarded – undo
2 2
 
3 3
 interface BaseFactoryInterface
4 4
 {
5
-    /**
6
-     * Construct the repository class name based on
7
-     * the method name called, search in the
8
-     * given namespaces for the class and
9
-     * return an instance.
10
-     *
11
-     * @param  string $name the called method name
12
-     * @param  array  $arguments the method arguments
13
-     * @return object
14
-     */
15
-    public function __call($name, $arguments);
5
+	/**
6
+	 * Construct the repository class name based on
7
+	 * the method name called, search in the
8
+	 * given namespaces for the class and
9
+	 * return an instance.
10
+	 *
11
+	 * @param  string $name the called method name
12
+	 * @param  array  $arguments the method arguments
13
+	 * @return object
14
+	 */
15
+	public function __call($name, $arguments);
16 16
 }
Please login to merge, or discard this patch.
src/Modules/Reporting/Repositories/ReportRepository.php 1 patch
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -5,65 +5,65 @@
 block discarded – undo
5 5
 
6 6
 class ReportRepository extends BaseRepository
7 7
 {
8
-    /**
9
-     * Init new object.
10
-     *
11
-     * @param   Report $model
12
-     * @return  void
13
-     */
14
-    public function __construct(Report $model)
15
-    {
16
-        parent::__construct($model);
17
-    }
8
+	/**
9
+	 * Init new object.
10
+	 *
11
+	 * @param   Report $model
12
+	 * @return  void
13
+	 */
14
+	public function __construct(Report $model)
15
+	{
16
+		parent::__construct($model);
17
+	}
18 18
 
19
-    /**
20
-     * Render the given report db view based on the given
21
-     * condition.
22
-     *
23
-     * @param  string  $reportName
24
-     * @param  array   $conditions
25
-     * @param  integer $perPage
26
-     * @param  array   $relations
27
-     * @param  boolean $skipPermission
28
-     * @return object
29
-     */
30
-    public function getReport($reportName, $conditions = [], $perPage = 0, $relations = [], $skipPermission = false)
31
-    {
32
-        /**
33
-         * Fetch the report from db.
34
-         */
35
-        $reportConditions = $this->constructConditions(['report_name' => $reportName], $this->model);
36
-        $report           = $this->model->with($relations)
37
-        ->whereRaw(
38
-            $reportConditions['conditionString'],
39
-            $reportConditions['conditionValues']
40
-        )->first();
19
+	/**
20
+	 * Render the given report db view based on the given
21
+	 * condition.
22
+	 *
23
+	 * @param  string  $reportName
24
+	 * @param  array   $conditions
25
+	 * @param  integer $perPage
26
+	 * @param  array   $relations
27
+	 * @param  boolean $skipPermission
28
+	 * @return object
29
+	 */
30
+	public function getReport($reportName, $conditions = [], $perPage = 0, $relations = [], $skipPermission = false)
31
+	{
32
+		/**
33
+		 * Fetch the report from db.
34
+		 */
35
+		$reportConditions = $this->constructConditions(['report_name' => $reportName], $this->model);
36
+		$report           = $this->model->with($relations)
37
+		->whereRaw(
38
+			$reportConditions['conditionString'],
39
+			$reportConditions['conditionValues']
40
+		)->first();
41 41
         
42
-        /**
43
-         * Check report existance and permission.
44
-         */
45
-        if (! $report) {
46
-            \ErrorHandler::notFound('report');
47
-        } elseif (! $skipPermission && ! \Core::users()->can($report->view_name, 'reports')) {
48
-            \ErrorHandler::noPermissions();
49
-        }
42
+		/**
43
+		 * Check report existance and permission.
44
+		 */
45
+		if (! $report) {
46
+			\ErrorHandler::notFound('report');
47
+		} elseif (! $skipPermission && ! \Core::users()->can($report->view_name, 'reports')) {
48
+			\ErrorHandler::noPermissions();
49
+		}
50 50
 
51
-        /**
52
-         * Fetch data from the report based on the given conditions.
53
-         */
54
-        $report = \DB::table($report->view_name);
55
-        unset($conditions['page']);
56
-        if (count($conditions)) {
57
-            $conditions = $this->constructConditions($conditions, $this->model);
58
-            $report->whereRaw($conditions['conditionString'], $conditions['conditionValues']);
59
-        }
60
-        /**
61
-         * Paginate or all data.
62
-         */
63
-        if ($perPage) {
64
-            return $report->paginate($perPage);
65
-        } else {
66
-            return $report->get();
67
-        }
68
-    }
51
+		/**
52
+		 * Fetch data from the report based on the given conditions.
53
+		 */
54
+		$report = \DB::table($report->view_name);
55
+		unset($conditions['page']);
56
+		if (count($conditions)) {
57
+			$conditions = $this->constructConditions($conditions, $this->model);
58
+			$report->whereRaw($conditions['conditionString'], $conditions['conditionValues']);
59
+		}
60
+		/**
61
+		 * Paginate or all data.
62
+		 */
63
+		if ($perPage) {
64
+			return $report->paginate($perPage);
65
+		} else {
66
+			return $report->get();
67
+		}
68
+	}
69 69
 }
Please login to merge, or discard this patch.
src/Modules/Notifications/Database/Seeds/NotificationsTableSeeder.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -6,46 +6,46 @@
 block discarded – undo
6 6
 
7 7
 class NotificationsTableSeeder 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
-                 * notifications model permissions.
23
-                 */
24
-                [
25
-                'name'       => 'all',
26
-                'model'      => 'notification',
27
-                'created_at' => \DB::raw('NOW()'),
28
-                'updated_at' => \DB::raw('NOW()')
29
-                ],
30
-                [
31
-                'name'       => 'unread',
32
-                'model'      => 'notification',
33
-                'created_at' => \DB::raw('NOW()'),
34
-                'updated_at' => \DB::raw('NOW()')
35
-                ],
36
-                [
37
-                'name'       => 'markAsRead',
38
-                'model'      => 'notification',
39
-                'created_at' => \DB::raw('NOW()'),
40
-                'updated_at' => \DB::raw('NOW()')
41
-                ],
42
-                [
43
-                'name'       => 'markAllAsRead',
44
-                'model'      => 'notification',
45
-                'created_at' => \DB::raw('NOW()'),
46
-                'updated_at' => \DB::raw('NOW()')
47
-                ]
48
-            ]
49
-        );
50
-    }
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
+				 * notifications model permissions.
23
+				 */
24
+				[
25
+				'name'       => 'all',
26
+				'model'      => 'notification',
27
+				'created_at' => \DB::raw('NOW()'),
28
+				'updated_at' => \DB::raw('NOW()')
29
+				],
30
+				[
31
+				'name'       => 'unread',
32
+				'model'      => 'notification',
33
+				'created_at' => \DB::raw('NOW()'),
34
+				'updated_at' => \DB::raw('NOW()')
35
+				],
36
+				[
37
+				'name'       => 'markAsRead',
38
+				'model'      => 'notification',
39
+				'created_at' => \DB::raw('NOW()'),
40
+				'updated_at' => \DB::raw('NOW()')
41
+				],
42
+				[
43
+				'name'       => 'markAllAsRead',
44
+				'model'      => 'notification',
45
+				'created_at' => \DB::raw('NOW()'),
46
+				'updated_at' => \DB::raw('NOW()')
47
+				]
48
+			]
49
+		);
50
+	}
51 51
 }
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
-        $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', ['notification', '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', ['notification', '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.
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('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', ['notification', '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.
src/Modules/Reporting/Database/Seeds/ReportsTableSeeder.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -6,40 +6,40 @@
 block discarded – undo
6 6
 
7 7
 class ReportsTableSeeder 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
-                 * Reports model permissions.
23
-                 */
24
-                [
25
-                'name'       => 'index',
26
-                'model'      => 'report',
27
-                'created_at' => \DB::raw('NOW()'),
28
-                'updated_at' => \DB::raw('NOW()')
29
-                ],
30
-                [
31
-                'name'       => 'find',
32
-                'model'      => 'report',
33
-                'created_at' => \DB::raw('NOW()'),
34
-                'updated_at' => \DB::raw('NOW()')
35
-                ],
36
-                [
37
-                'name'       => 'admin_count',
38
-                'model'      => 'report',
39
-                'created_at' => \DB::raw('NOW()'),
40
-                'updated_at' => \DB::raw('NOW()')
41
-                ]
42
-            ]
43
-        );
44
-    }
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
+				 * Reports model permissions.
23
+				 */
24
+				[
25
+				'name'       => 'index',
26
+				'model'      => 'report',
27
+				'created_at' => \DB::raw('NOW()'),
28
+				'updated_at' => \DB::raw('NOW()')
29
+				],
30
+				[
31
+				'name'       => 'find',
32
+				'model'      => 'report',
33
+				'created_at' => \DB::raw('NOW()'),
34
+				'updated_at' => \DB::raw('NOW()')
35
+				],
36
+				[
37
+				'name'       => 'admin_count',
38
+				'model'      => 'report',
39
+				'created_at' => \DB::raw('NOW()'),
40
+				'updated_at' => \DB::raw('NOW()')
41
+				]
42
+			]
43
+		);
44
+	}
45 45
 }
Please login to merge, or discard this patch.
src/Modules/Reporting/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
-        $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', ['report'])->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', ['report'])->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.
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('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', ['report']);
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/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.