Completed
Push — master ( 60eb24...8a761d )
by Sherif
01:58
created
src/Modules/Core/Interfaces/BaseServiceInterface.php 1 patch
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -2,93 +2,93 @@
 block discarded – undo
2 2
 
3 3
 interface BaseServiceInterface
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 = ['*']);
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 = ['*']);
15 15
 
16
-    /**
17
-     * Fetch all records with relations from storage in pages.
18
-     *
19
-     * @param  integer $perPage
20
-     * @param  array   $relations
21
-     * @param  array   $sortBy
22
-     * @param  array   $desc
23
-     * @param  array   $columns
24
-     * @return collection
25
-     */
26
-    public function paginate($perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = ['*']);
16
+	/**
17
+	 * Fetch all records with relations from storage in pages.
18
+	 *
19
+	 * @param  integer $perPage
20
+	 * @param  array   $relations
21
+	 * @param  array   $sortBy
22
+	 * @param  array   $desc
23
+	 * @param  array   $columns
24
+	 * @return collection
25
+	 */
26
+	public function paginate($perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = ['*']);
27 27
     
28
-    /**
29
-     * Fetch all records with relations based on
30
-     * the given condition from storage in pages.
31
-     *
32
-     * @param  array   $conditions array of conditions
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 paginateBy($conditions, $perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = ['*']);
28
+	/**
29
+	 * Fetch all records with relations based on
30
+	 * the given condition from storage in pages.
31
+	 *
32
+	 * @param  array   $conditions array of conditions
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 paginateBy($conditions, $perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = ['*']);
41 41
 
42
-     /**
43
-      * Save the given model/models to the storage.
44
-      *
45
-      * @param  array   $data
46
-      * @return mixed
47
-      */
48
-    public function save(array $data);
42
+	 /**
43
+	  * Save the given model/models to the storage.
44
+	  *
45
+	  * @param  array   $data
46
+	  * @return mixed
47
+	  */
48
+	public function save(array $data);
49 49
 
50
-    /**
51
-     * Delete record from the storage based on the given
52
-     * condition.
53
-     *
54
-     * @param  var     $value condition value
55
-     * @param  string  $attribute condition column name
56
-     * @return integer affected rows
57
-     */
58
-    public function delete($value, $attribute = 'id');
50
+	/**
51
+	 * Delete record from the storage based on the given
52
+	 * condition.
53
+	 *
54
+	 * @param  var     $value condition value
55
+	 * @param  string  $attribute condition column name
56
+	 * @return integer affected rows
57
+	 */
58
+	public function delete($value, $attribute = 'id');
59 59
     
60
-    /**
61
-     * Fetch records from the storage based on the given
62
-     * id.
63
-     *
64
-     * @param  integer $id
65
-     * @param  array   $relations
66
-     * @param  array   $columns
67
-     * @return object
68
-     */
69
-    public function find($id, $relations = [], $columns = ['*']);
60
+	/**
61
+	 * Fetch records from the storage based on the given
62
+	 * id.
63
+	 *
64
+	 * @param  integer $id
65
+	 * @param  array   $relations
66
+	 * @param  array   $columns
67
+	 * @return object
68
+	 */
69
+	public function find($id, $relations = [], $columns = ['*']);
70 70
     
71
-    /**
72
-     * Fetch records from the storage based on the given
73
-     * condition.
74
-     *
75
-     * @param  array   $conditions array of conditions
76
-     * @param  array   $relations
77
-     * @param  array   $sortBy
78
-     * @param  array   $desc
79
-     * @param  array   $columns
80
-     * @return collection
81
-     */
82
-    public function findBy($conditions, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = ['*']);
71
+	/**
72
+	 * Fetch records from the storage based on the given
73
+	 * condition.
74
+	 *
75
+	 * @param  array   $conditions array of conditions
76
+	 * @param  array   $relations
77
+	 * @param  array   $sortBy
78
+	 * @param  array   $desc
79
+	 * @param  array   $columns
80
+	 * @return collection
81
+	 */
82
+	public function findBy($conditions, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = ['*']);
83 83
 
84
-    /**
85
-     * Fetch the first record fro the storage based on the given
86
-     * condition.
87
-     *
88
-     * @param  array   $conditions array of conditions
89
-     * @param  array   $relations
90
-     * @param  array   $columns
91
-     * @return object
92
-     */
93
-    public function first($conditions, $relations = [], $columns = ['*']);
84
+	/**
85
+	 * Fetch the first record fro the storage based on the given
86
+	 * condition.
87
+	 *
88
+	 * @param  array   $conditions array of conditions
89
+	 * @param  array   $relations
90
+	 * @param  array   $columns
91
+	 * @return object
92
+	 */
93
+	public function first($conditions, $relations = [], $columns = ['*']);
94 94
 }
Please login to merge, or discard this patch.
src/Modules/Permissions/Resources/Lang/en/errors.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@
 block discarded – undo
2 2
 
3 3
 return [
4 4
     
5
-    /**
6
-     * Here goes your error messages.
7
-     */
5
+	/**
6
+	 * Here goes your error messages.
7
+	 */
8 8
 
9 9
 ];
Please login to merge, or discard this patch.
src/Modules/Core/Facades/Errors.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 
5 5
 class Errors extends Facade
6 6
 {
7
-    protected static function getFacadeAccessor()
8
-    {
9
-        return 'Errors';
10
-    }
7
+	protected static function getFacadeAccessor()
8
+	{
9
+		return 'Errors';
10
+	}
11 11
 }
Please login to merge, or discard this patch.
src/Modules/Roles/ModelObservers/RoleObserver.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -7,69 +7,69 @@
 block discarded – undo
7 7
  */
8 8
 class RoleObserver
9 9
 {
10
-    public function saving($model)
11
-    {
12
-        //
13
-    }
10
+	public function saving($model)
11
+	{
12
+		//
13
+	}
14 14
 
15
-    public function saved($model)
16
-    {
17
-        //
18
-    }
15
+	public function saved($model)
16
+	{
17
+		//
18
+	}
19 19
 
20
-    public function creating($model)
21
-    {
22
-        //
23
-    }
20
+	public function creating($model)
21
+	{
22
+		//
23
+	}
24 24
 
25
-    public function created($model)
26
-    {
27
-        //
28
-    }
25
+	public function created($model)
26
+	{
27
+		//
28
+	}
29 29
 
30
-    /**
31
-     * Prevent updating of the admin role.
32
-     *
33
-     * @param  object $model the model beign updated.
34
-     * @return void
35
-     */
36
-    public function updating($model)
37
-    {
38
-        if ($model->getOriginal('name') == 'Admin') {
39
-            \Errors::noPermissions();
40
-        }
41
-    }
30
+	/**
31
+	 * Prevent updating of the admin role.
32
+	 *
33
+	 * @param  object $model the model beign updated.
34
+	 * @return void
35
+	 */
36
+	public function updating($model)
37
+	{
38
+		if ($model->getOriginal('name') == 'Admin') {
39
+			\Errors::noPermissions();
40
+		}
41
+	}
42 42
 
43
-    public function updated($model)
44
-    {
45
-        //
46
-    }
43
+	public function updated($model)
44
+	{
45
+		//
46
+	}
47 47
 
48
-    /**
49
-     * Prevent deleting the admin role.
50
-     *
51
-     * @param  object $model the delted model.
52
-     * @return void
53
-     */
54
-    public function deleting($model)
55
-    {
56
-        if ($model->getOriginal('name') == 'Admin') {
57
-            \Errors::noPermissions();
58
-        }
59
-    }
48
+	/**
49
+	 * Prevent deleting the admin role.
50
+	 *
51
+	 * @param  object $model the delted model.
52
+	 * @return void
53
+	 */
54
+	public function deleting($model)
55
+	{
56
+		if ($model->getOriginal('name') == 'Admin') {
57
+			\Errors::noPermissions();
58
+		}
59
+	}
60 60
 
61
-    public function deleted($model)
62
-    {
63
-        //
64
-    }
61
+	public function deleted($model)
62
+	{
63
+		//
64
+	}
65 65
 
66
-    public function restoring($model)
67
-    {
68
-        //
69
-    }
66
+	public function restoring($model)
67
+	{
68
+		//
69
+	}
70 70
 
71
-    public function restored($model)
72
-    {
73
-        //
74
-    }
71
+	public function restored($model)
72
+	{
73
+		//
74
+	}
75 75
 }
Please login to merge, or discard this patch.
src/Modules/Users/Resources/Lang/en/errors.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -2,21 +2,21 @@
 block discarded – undo
2 2
 
3 3
 return [
4 4
     
5
-    /**
6
-     * Here goes your error messages.
7
-     */
8
-    'unAuthorized'            => 'Please login before any action',
9
-    'invalidRefreshToken'     => 'Invalid refresh token',
10
-    'noPermissions'           => 'No permissions',
11
-    'loginFailed'             => 'Wrong mail or password',
12
-    'noSocialEmail'           => 'Couldn\'t retrieve email',
13
-    'userAlreadyRegistered'   => 'User already registered. Please login using email and password',
14
-    'userIsBlocked'           => 'You have been blocked',
15
-    'invalidResetToken'       => 'Reset password token is invalid',
16
-    'invalidResetPassword'    => 'Reset password is invalid',
17
-    'invalidOldPassword'      => 'Old password is invalid',
18
-    'invalidConfirmationCode' => 'Confirmation link expired or already used',
19
-    'emailNotConfirmed'       => 'Your email isn\'t confirmed',
20
-    'emailAlreadyConfirmed'   => 'Your email is already confirmed'
5
+	/**
6
+	 * Here goes your error messages.
7
+	 */
8
+	'unAuthorized'            => 'Please login before any action',
9
+	'invalidRefreshToken'     => 'Invalid refresh token',
10
+	'noPermissions'           => 'No permissions',
11
+	'loginFailed'             => 'Wrong mail or password',
12
+	'noSocialEmail'           => 'Couldn\'t retrieve email',
13
+	'userAlreadyRegistered'   => 'User already registered. Please login using email and password',
14
+	'userIsBlocked'           => 'You have been blocked',
15
+	'invalidResetToken'       => 'Reset password token is invalid',
16
+	'invalidResetPassword'    => 'Reset password is invalid',
17
+	'invalidOldPassword'      => 'Old password is invalid',
18
+	'invalidConfirmationCode' => 'Confirmation link expired or already used',
19
+	'emailNotConfirmed'       => 'Your email isn\'t confirmed',
20
+	'emailAlreadyConfirmed'   => 'Your email is already confirmed'
21 21
 
22 22
 ];
Please login to merge, or discard this patch.
src/Modules/Users/Resources/Lang/ar/errors.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -2,21 +2,21 @@
 block discarded – undo
2 2
 
3 3
 return [
4 4
     
5
-    /**
6
-     * Here goes your error messages.
7
-     */
8
-    'unAuthorized'            => 'من فضلك قم بتسجيل الدخول',
9
-    'invalidRefreshToken'     => 'رمز التحديث غير صالح',
10
-    'noPermissions'           => 'لا توجد صلاحية',
11
-    'loginFailed'             => 'خطأ في البريد لاكتروني او كلمة المرور',
12
-    'noSocialEmail'           => 'لا يمكن الحصول علي تابريد الاكتروني',
13
-    'userAlreadyRegistered'   => 'المستخد مسجل بالفعل.سجل الدخول بالبريد الاكتروني و كلمة السر',
14
-    'userIsBlocked'           => 'لقد تم حظرك',
15
-    'invalidResetToken'       => 'رمز تعديل كلمة المرور خطا',
16
-    'invalidResetPassword'    => 'خطا في نعديل كلمة المرور',
17
-    'invalidOldPassword'      => 'كلمة السر القديمه خطا',
18
-    'invalidConfirmationCode' => 'لينك التاكيد غير صالح اة مستخدم من قبل',
19
-    'emailNotConfirmed'       => 'بريدك الاكتروني غير مفعل',
20
-    'emailAlreadyConfirmed'   => 'البريد الاكتروني مفع بالقعل'
5
+	/**
6
+	 * Here goes your error messages.
7
+	 */
8
+	'unAuthorized'            => 'من فضلك قم بتسجيل الدخول',
9
+	'invalidRefreshToken'     => 'رمز التحديث غير صالح',
10
+	'noPermissions'           => 'لا توجد صلاحية',
11
+	'loginFailed'             => 'خطأ في البريد لاكتروني او كلمة المرور',
12
+	'noSocialEmail'           => 'لا يمكن الحصول علي تابريد الاكتروني',
13
+	'userAlreadyRegistered'   => 'المستخد مسجل بالفعل.سجل الدخول بالبريد الاكتروني و كلمة السر',
14
+	'userIsBlocked'           => 'لقد تم حظرك',
15
+	'invalidResetToken'       => 'رمز تعديل كلمة المرور خطا',
16
+	'invalidResetPassword'    => 'خطا في نعديل كلمة المرور',
17
+	'invalidOldPassword'      => 'كلمة السر القديمه خطا',
18
+	'invalidConfirmationCode' => 'لينك التاكيد غير صالح اة مستخدم من قبل',
19
+	'emailNotConfirmed'       => 'بريدك الاكتروني غير مفعل',
20
+	'emailAlreadyConfirmed'   => 'البريد الاكتروني مفع بالقعل'
21 21
 
22 22
 ];
Please login to merge, or discard this patch.
src/Modules/Users/Errors/UsersErrors.php 1 patch
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -4,68 +4,68 @@
 block discarded – undo
4 4
 
5 5
 class UsersErrors
6 6
 {
7
-    public function unAuthorized()
8
-    {
9
-        abort(401, trans('users::errors.unAuthorized'));
10
-    }
7
+	public function unAuthorized()
8
+	{
9
+		abort(401, trans('users::errors.unAuthorized'));
10
+	}
11 11
 
12
-    public function noPermissions()
13
-    {
14
-        abort(403, trans('users::errors.noPermissions'));
15
-    }
12
+	public function noPermissions()
13
+	{
14
+		abort(403, trans('users::errors.noPermissions'));
15
+	}
16 16
 
17
-    public function userIsBlocked()
18
-    {
19
-        abort(403, trans('users::errors.userIsBlocked'));
20
-    }
17
+	public function userIsBlocked()
18
+	{
19
+		abort(403, trans('users::errors.userIsBlocked'));
20
+	}
21 21
 
22
-    public function emailNotConfirmed()
23
-    {
24
-        abort(403, trans('users::errors.emailNotConfirmed'));
25
-    }
22
+	public function emailNotConfirmed()
23
+	{
24
+		abort(403, trans('users::errors.emailNotConfirmed'));
25
+	}
26 26
 
27
-    public function loginFailed()
28
-    {
29
-        abort(400, trans('users::errors.loginFailed'));
30
-    }
27
+	public function loginFailed()
28
+	{
29
+		abort(400, trans('users::errors.loginFailed'));
30
+	}
31 31
 
32
-    public function emailAlreadyConfirmed()
33
-    {
34
-        abort(400, trans('users::errors.emailAlreadyConfirmed'));
35
-    }
32
+	public function emailAlreadyConfirmed()
33
+	{
34
+		abort(400, trans('users::errors.emailAlreadyConfirmed'));
35
+	}
36 36
 
37
-    public function noSocialEmail()
38
-    {
39
-        abort(400, trans('users::errors.noSocialEmail'));
40
-    }
37
+	public function noSocialEmail()
38
+	{
39
+		abort(400, trans('users::errors.noSocialEmail'));
40
+	}
41 41
 
42
-    public function userAlreadyRegistered()
43
-    {
44
-        abort(400, trans('users::errors.userAlreadyRegistered'));
45
-    }
42
+	public function userAlreadyRegistered()
43
+	{
44
+		abort(400, trans('users::errors.userAlreadyRegistered'));
45
+	}
46 46
 
47
-    public function invalidRefreshToken()
48
-    {
49
-        abort(422, trans('users::errors.invalidRefreshToken'));
50
-    }
47
+	public function invalidRefreshToken()
48
+	{
49
+		abort(422, trans('users::errors.invalidRefreshToken'));
50
+	}
51 51
 
52
-    public function invalidResetToken()
53
-    {
54
-        abort(422, trans('users::errors.invalidResetToken'));
55
-    }
52
+	public function invalidResetToken()
53
+	{
54
+		abort(422, trans('users::errors.invalidResetToken'));
55
+	}
56 56
 
57
-    public function invalidResetPassword()
58
-    {
59
-        abort(422, trans('users::errors.invalidResetPassword'));
60
-    }
57
+	public function invalidResetPassword()
58
+	{
59
+		abort(422, trans('users::errors.invalidResetPassword'));
60
+	}
61 61
 
62
-    public function invalidOldPassword()
63
-    {
64
-        abort(422, trans('users::errors.invalidOldPassword'));
65
-    }
62
+	public function invalidOldPassword()
63
+	{
64
+		abort(422, trans('users::errors.invalidOldPassword'));
65
+	}
66 66
 
67
-    public function invalidConfirmationCode()
68
-    {
69
-        abort(422, trans('users::errors.invalidConfirmationCode'));
70
-    }
67
+	public function invalidConfirmationCode()
68
+	{
69
+		abort(422, trans('users::errors.invalidConfirmationCode'));
70
+	}
71 71
 }
Please login to merge, or discard this patch.
src/Modules/Reporting/Services/ReportService.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -8,49 +8,49 @@
 block discarded – undo
8 8
 
9 9
 class ReportService extends BaseService
10 10
 {
11
-    /**
12
-     * @var UserService
13
-     */
14
-    protected $userService;
11
+	/**
12
+	 * @var UserService
13
+	 */
14
+	protected $userService;
15 15
 
16
-    /**
17
-     * Init new object.
18
-     *
19
-     * @param   ReportRepository $repo
20
-     * @return  void
21
-     */
22
-    public function __construct(ReportRepository $repo, UserService $userService)
23
-    {
24
-        $this->userService = $userService;
25
-        parent::__construct($repo);
26
-    }
16
+	/**
17
+	 * Init new object.
18
+	 *
19
+	 * @param   ReportRepository $repo
20
+	 * @return  void
21
+	 */
22
+	public function __construct(ReportRepository $repo, UserService $userService)
23
+	{
24
+		$this->userService = $userService;
25
+		parent::__construct($repo);
26
+	}
27 27
 
28
-    /**
29
-     * Render the given report db view based on the given
30
-     * condition.
31
-     *
32
-     * @param  string  $reportName
33
-     * @param  array   $conditions
34
-     * @param  integer $perPage
35
-     * @param  boolean $skipPermission
36
-     * @return object
37
-     */
38
-    public function getReport($reportName, $conditions = [], $perPage = 0, $skipPermission = false)
39
-    {
40
-        /**
41
-         * Fetch the report from db.
42
-         */
43
-        $report = $this->repo->first(['report_name' => $reportName]);
28
+	/**
29
+	 * Render the given report db view based on the given
30
+	 * condition.
31
+	 *
32
+	 * @param  string  $reportName
33
+	 * @param  array   $conditions
34
+	 * @param  integer $perPage
35
+	 * @param  boolean $skipPermission
36
+	 * @return object
37
+	 */
38
+	public function getReport($reportName, $conditions = [], $perPage = 0, $skipPermission = false)
39
+	{
40
+		/**
41
+		 * Fetch the report from db.
42
+		 */
43
+		$report = $this->repo->first(['report_name' => $reportName]);
44 44
 
45
-        /**
46
-         * Check report existance and permission.
47
-         */
48
-        if (! $report) {
49
-            \Errors::notFound('report');
50
-        } elseif (! $skipPermission && ! $this->userService->can($report->view_name, 'report')) {
51
-            \Errors::noPermissions();
52
-        }
45
+		/**
46
+		 * Check report existance and permission.
47
+		 */
48
+		if (! $report) {
49
+			\Errors::notFound('report');
50
+		} elseif (! $skipPermission && ! $this->userService->can($report->view_name, 'report')) {
51
+			\Errors::noPermissions();
52
+		}
53 53
 
54
-        return $this->repo->renderReport($report, $conditions, $perPage);
55
-    }
54
+		return $this->repo->renderReport($report, $conditions, $perPage);
55
+	}
56 56
 }
Please login to merge, or discard this patch.
src/Modules/Roles/Resources/Lang/en/errors.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@
 block discarded – undo
2 2
 
3 3
 return [
4 4
     
5
-    /**
6
-     * Here goes your error messages.
7
-     */
5
+	/**
6
+	 * Here goes your error messages.
7
+	 */
8 8
 
9 9
 ];
Please login to merge, or discard this patch.