Completed
Pull Request — master (#6)
by Jonathan
16:01 queued 06:12
created
app/Http/Controllers/Core/SwaggerController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
     public function docs($jsonFile = null)
21 21
     {
22 22
         $filePath = config('l5-swagger.paths.docs').'/'.
23
-            (! is_null($jsonFile) ? $jsonFile : config('l5-swagger.paths.docs_json', 'api-docs.json'));
23
+            (!is_null($jsonFile) ? $jsonFile : config('l5-swagger.paths.docs_json', 'api-docs.json'));
24 24
 
25
-        if (! File::exists($filePath)) {
25
+        if (!File::exists($filePath)) {
26 26
             try {
27 27
                 Generator::generateDocs();
28 28
             } catch (\Exception $e) {
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
         }
50 50
 
51 51
         if ($proxy = config('l5-swagger.proxy')) {
52
-            if (! is_array($proxy)) {
53
-                $proxy = [$proxy];
52
+            if (!is_array($proxy)) {
53
+                $proxy = [ $proxy ];
54 54
             }
55 55
 
56 56
             Request::setTrustedProxies($proxy, \Illuminate\Http\Request::HEADER_X_FORWARDED_ALL);
Please login to merge, or discard this patch.
app/Http/Controllers/Core/EditController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      * @param boolean $redirect
69 69
      * @return void
70 70
      */
71
-    public function save(?Domain $domain, Module $module, Request $request, bool $redirect=true)
71
+    public function save(?Domain $domain, Module $module, Request $request, bool $redirect = true)
72 72
     {
73 73
         // Pre-process
74 74
         $this->preProcess($domain, $module, $request);
@@ -109,15 +109,15 @@  discard block
 block discarded – undo
109 109
         if ($redirect === true) {
110 110
             // Redirect to source record if a relation was made
111 111
             if (isset($relatedlist) && $redirectToSourceRecord === true) {
112
-                $params = ['id' => $sourceRecordId];
112
+                $params = [ 'id' => $sourceRecordId ];
113 113
 
114 114
                 // Add tab id if defined to select it automaticaly
115 115
                 if ($tabId) {
116
-                    $params['tab'] = $tabId;
116
+                    $params[ 'tab' ] = $tabId;
117 117
                 }
118 118
                 // Add related list id to select the related tab automaticaly
119 119
                 else {
120
-                    $params['relatedlist'] = $relatedlist->id;
120
+                    $params[ 'relatedlist' ] = $relatedlist->id;
121 121
                 }
122 122
 
123 123
                 $route = ucroute('uccello.detail', $domain, $relatedlist->module, $params);
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             }
130 130
             // Else redirect to detail
131 131
             else {
132
-                $route = ucroute('uccello.detail', $domain, $module, ['id' => $record->getKey()]);
132
+                $route = ucroute('uccello.detail', $domain, $module, [ 'id' => $record->getKey() ]);
133 133
             }
134 134
 
135 135
             return redirect($route);
Please login to merge, or discard this patch.
app/Http/Controllers/Core/DetailController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@
 block discarded – undo
31 31
         $recordId = $request->input('id');
32 32
 
33 33
         // Selected tab
34
-        $selectedTabId = (int) $request->input('tab');
34
+        $selectedTabId = (int)$request->input('tab');
35 35
 
36 36
         // Selected related list
37
-        $selectedRelatedlistId = (int) $request->input('relatedlist');
37
+        $selectedRelatedlistId = (int)$request->input('relatedlist');
38 38
 
39 39
         return $this->autoView([
40 40
             'record' => $this->getRecord($recordId),
Please login to merge, or discard this patch.
app/Http/Controllers/Core/DeleteController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -68,15 +68,15 @@
 block discarded – undo
68 68
 
69 69
         // Redirect to source record if a relation was deleted
70 70
         if (isset($relatedlist) && $request->input('src_id')) {
71
-            $params = ['id' => $request->input('src_id')];
71
+            $params = [ 'id' => $request->input('src_id') ];
72 72
 
73 73
             // Add tab id if defined to select it automaticaly
74 74
             if ($request->input('tab')) {
75
-                $params['tab'] = $request->input('tab');
75
+                $params[ 'tab' ] = $request->input('tab');
76 76
             }
77 77
             // Add related list id to select the related tab automaticaly
78 78
             else {
79
-                $params['relatedlist'] = $relatedlist->id;
79
+                $params[ 'relatedlist' ] = $relatedlist->id;
80 80
             }
81 81
 
82 82
             $route = ucroute('uccello.detail', $domain, $relatedlist->module, $params);
Please login to merge, or discard this patch.
app/Http/Controllers/Core/Controller.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      */
146 146
     protected function getAllModules($getAdminModules = false)
147 147
     {
148
-        $modules = [];
148
+        $modules = [ ];
149 149
 
150 150
         $allModules = Module::all();
151 151
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
         } else {
155 155
             foreach ($allModules as $module) {
156 156
                 if (!$module->isAdminModule()) {
157
-                    $modules[] = $module;
157
+                    $modules[ ] = $module;
158 158
                 }
159 159
             }
160 160
         }
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 
179 179
         // An id is defined, retrieve the record from the database fail (404)
180 180
         if ($this->request->has('id')) {
181
-            $recordId = (int) $this->request->input('id');
181
+            $recordId = (int)$this->request->input('id');
182 182
             $record = $modelClass::findOrFail($recordId);
183 183
         }
184 184
         // Make a new empty instance
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
      * @param  array   $mergeData
202 202
      * @return \Illuminate\View\View|\Illuminate\Contracts\View\Factory
203 203
      */
204
-    protected function autoView($data = [], $mergeData = [])
204
+    protected function autoView($data = [ ], $mergeData = [ ])
205 205
     {
206 206
         $viewToUse = uccello()->view($this->module->package, $this->module, $this->viewName);
207 207
 
Please login to merge, or discard this patch.
app/Http/Controllers/Core/ApiAuthController.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
      */
16 16
     public function __construct()
17 17
     {
18
-        $this->middleware('auth:api', ['except' => ['login']]);
18
+        $this->middleware('auth:api', [ 'except' => [ 'login' ] ]);
19 19
     }
20 20
 
21 21
     /**
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
         $input = $request->only('email', 'password');
35 35
         $validator = Validator::make($input, $rules);
36 36
 
37
-        if($validator->fails()) {
37
+        if ($validator->fails()) {
38 38
             $error = $validator->messages();
39
-            return response()->json(['success'=> false, 'error'=> $error]);
39
+            return response()->json([ 'success'=> false, 'error'=> $error ]);
40 40
         }
41 41
 
42 42
         $credentials = [
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
         try {
48 48
             // attempt to verify the credentials and create a token for the user
49
-            if (! $token = JWTAuth::attempt($credentials)) {
49
+            if (!$token = JWTAuth::attempt($credentials)) {
50 50
 
51 51
                 //Check if it exists a user to validate
52 52
                 $user = User::where('email', $request->email)->first();
@@ -58,15 +58,15 @@  discard block
 block discarded – undo
58 58
 
59 59
                 return $user;
60 60
 
61
-                return response()->json(['success' => false, 'error' => 'Invalid Credentials. Please make sure you entered the right information and you have verified your email address.'], 401);
61
+                return response()->json([ 'success' => false, 'error' => 'Invalid Credentials. Please make sure you entered the right information and you have verified your email address.' ], 401);
62 62
             }
63 63
         } catch (JWTException $e) {
64 64
             // something went wrong whilst attempting to encode the token
65
-            return response()->json(['success' => false, 'error' => 'could_not_create_token'], 500);
65
+            return response()->json([ 'success' => false, 'error' => 'could_not_create_token' ], 500);
66 66
         }
67 67
 
68 68
         // all good so return the token
69
-        return response()->json(['success' => true, 'result'=>  $token]);
69
+        return response()->json([ 'success' => true, 'result'=>  $token ]);
70 70
     }
71 71
 
72 72
     /**
@@ -85,20 +85,20 @@  discard block
 block discarded – undo
85 85
         $input = request()->only('login', 'password');
86 86
         $validator = Validator::make($input, $rules);
87 87
 
88
-        if($validator->fails()) {
88
+        if ($validator->fails()) {
89 89
             $error = $validator->messages();
90
-            return response()->json(['success'=> false, 'error'=> $error], 400);
90
+            return response()->json([ 'success'=> false, 'error'=> $error ], 400);
91 91
         }
92 92
 
93 93
         // Detect if it is an email or an username
94 94
         $login = request()->get('login');
95 95
         $loginFieldName = filter_var($login, FILTER_VALIDATE_EMAIL) ? 'email' : 'username';
96
-        request()->merge([$loginFieldName => $login]);
96
+        request()->merge([ $loginFieldName => $login ]);
97 97
 
98
-        $credentials = request([$loginFieldName, 'password']);
98
+        $credentials = request([ $loginFieldName, 'password' ]);
99 99
 
100
-        if (! $token = JWTAuth::attempt($credentials)) {
101
-            return response()->json(['error' => 'User unauthorized'], 401);
100
+        if (!$token = JWTAuth::attempt($credentials)) {
101
+            return response()->json([ 'error' => 'User unauthorized' ], 401);
102 102
         }
103 103
 
104 104
         return $this->respondWithToken($token);
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     {
124 124
         auth()->logout();
125 125
 
126
-        return response()->json(['message' => 'Successfully logged out']);
126
+        return response()->json([ 'message' => 'Successfully logged out' ]);
127 127
     }
128 128
 
129 129
     /**
Please login to merge, or discard this patch.
app/Http/Controllers/User/EditController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,18 +21,18 @@
 block discarded – undo
21 21
         $record = $this->getRecordFromRequest();
22 22
 
23 23
         // Get roles already linked to the role
24
-        $selectedRoleIds = [];
24
+        $selectedRoleIds = [ ];
25 25
 
26 26
         if ($record) {
27 27
             foreach ($record->rolesOnDomain($domain) as $role) {
28
-                $selectedRoleIds[] = $role->id;
28
+                $selectedRoleIds[ ] = $role->id;
29 29
             }
30 30
         }
31 31
 
32 32
         // Get all domain roles
33
-        $roles = [];
33
+        $roles = [ ];
34 34
         foreach ($domain->roles as $role) {
35
-            $roles[$role->id] = $role->name;
35
+            $roles[ $role->id ] = $role->name;
36 36
         }
37 37
 
38 38
         // Add data to the view
Please login to merge, or discard this patch.
app/Http/Controllers/Role/EditController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,21 +21,21 @@
 block discarded – undo
21 21
         $record = $this->getRecordFromRequest();
22 22
 
23 23
         // Get profiles already linked to the role
24
-        $selectedProfileIds = [];
24
+        $selectedProfileIds = [ ];
25 25
         if ($record) {
26 26
             foreach ($record->profiles as $profile) {
27 27
                 // Check if the profile is still in the domain
28 28
                 // It is just a security because $profiles (see below) is filtered on the domain
29 29
                 if ($profile->domain->id === $domain->id) {
30
-                    $selectedProfileIds[] = $profile->id;
30
+                    $selectedProfileIds[ ] = $profile->id;
31 31
                 }
32 32
             }
33 33
         }
34 34
 
35 35
         // Get all domain profiles
36
-        $profiles = [];
36
+        $profiles = [ ];
37 37
         foreach ($domain->profiles as $profile) {
38
-            $profiles[$profile->id] = $profile->name;
38
+            $profiles[ $profile->id ] = $profile->name;
39 39
         }
40 40
 
41 41
         // Add data to the view
Please login to merge, or discard this patch.
app/Http/Middleware/CheckPermissions.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
         $isModuleActive = $module->isActiveOnDomain($domain);
34 34
 
35 35
         // An user is allowed if he has the capability or if it is an admin module and the user can admin it
36
-        $isUserAllowed =  $user->hasCapabilityOnModule($capability, $domain, $module) || ($module->isAdminModule() && $user->canAdmin($domain, $module));
36
+        $isUserAllowed = $user->hasCapabilityOnModule($capability, $domain, $module) || ($module->isAdminModule() && $user->canAdmin($domain, $module));
37 37
 
38 38
         if (!$isModuleActive) {
39 39
             return abort(404);
Please login to merge, or discard this patch.