Passed
Push — master ( 7d362e...62822e )
by Omar El
02:41
created
app/Http/routes.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 
14 14
 // Home Page
15 15
 $app->get('/', function () use ($app){
16
-	return $app->version();
16
+    return $app->version();
17 17
 });
18 18
 
19 19
 // Posts
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@
 block discarded – undo
12 12
 */
13 13
 
14 14
 // Home Page
15
-$app->get('/', function () use ($app){
15
+$app->get('/', function() use ($app){
16 16
 	return $app->version();
17 17
 });
18 18
 
19 19
 // Posts
20
-$app->get('/posts','PostController@index');
21
-$app->post('/posts','PostController@store');
22
-$app->get('/posts/{post_id}','PostController@show');
20
+$app->get('/posts', 'PostController@index');
21
+$app->post('/posts', 'PostController@store');
22
+$app->get('/posts/{post_id}', 'PostController@show');
23 23
 $app->put('/posts/{post_id}', 'PostController@update');
24 24
 $app->patch('/posts/{post_id}', 'PostController@update');
25 25
 $app->delete('/posts/{post_id}', 'PostController@destroy');
Please login to merge, or discard this patch.
app/User.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@
 block discarded – undo
40 40
      * @return int|boolean
41 41
      * @see    https://github.com/lucadegasperi/oauth2-server-laravel/blob/master/docs/authorization-server/password.md
42 42
      */
43
-    public function verify($email, $password){
43
+    public function verify($email, $password) {
44 44
 
45 45
         $user = User::where('email', $email)->first();
46 46
 
47
-        if($user && Hash::check($password, $user->password)){
47
+        if ($user && Hash::check($password, $user->password)) {
48 48
             return $user->id;
49 49
         }
50 50
 
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,6 @@
 block discarded – undo
7 7
 use Illuminate\Database\Eloquent\Model;
8 8
 use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
9 9
 use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
10
-
11 10
 use Illuminate\Support\Facades\Hash;
12 11
 
13 12
 class User extends Model implements AuthenticatableContract, AuthorizableContract
Please login to merge, or discard this patch.
app/Http/Controllers/Controller.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
      * Check if the user is authorized to perform a given action on a resource.
36 36
      *
37 37
      * @param  \Illuminate\Http\Request  $request
38
-     * @param  array $resource
38
+     * @param  string $resource
39 39
      * @param  mixed|array $arguments
40 40
      * @return boolean
41 41
      * @see    https://lumen.laravel.com/docs/authorization 
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
      * @param  string $code
17 17
      * @return \Illuminate\Http\JsonResponse
18 18
      */
19
-	public function success($data, $code){
20
-		return response()->json(['data' => $data], $code);
21
-	}
19
+    public function success($data, $code){
20
+        return response()->json(['data' => $data], $code);
21
+    }
22 22
 
23 23
     /**
24 24
      * Return a JSON response for error.
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
      * @param  string $code
28 28
      * @return \Illuminate\Http\JsonResponse
29 29
      */
30
-	public function error($message, $code){
31
-		return response()->json(['message' => $message], $code);
32
-	}
30
+    public function error($message, $code){
31
+        return response()->json(['message' => $message], $code);
32
+    }
33 33
 
34 34
     /**
35 35
      * Check if the user is authorized to perform a given action on a resource.
@@ -42,14 +42,14 @@  discard block
 block discarded – undo
42 42
      */
43 43
     protected function authorizeUser(Request $request, $resource, $arguments = []){
44 44
     	
45
-    	$user 	 = User::find($this->getUserId());
46
-    	$action	 = $this->getAction($request); 
45
+        $user 	 = User::find($this->getUserId());
46
+        $action	 = $this->getAction($request); 
47 47
 
48 48
         // The ability string must match the string defined in App\Providers\AuthServiceProvider\ability()
49 49
         $ability = "{$action}-{$resource}";
50 50
 
51
-    	// return $this->authorizeForUser($user, "{$action}-{$resource}", $data);
52
-    	return Gate::forUser($user)->allows($ability, $arguments);
51
+        // return $this->authorizeForUser($user, "{$action}-{$resource}", $data);
52
+        return Gate::forUser($user)->allows($ability, $arguments);
53 53
     }
54 54
 
55 55
     /**
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      * @return boolean
73 73
      */
74 74
     protected function getUserId(){
75
-    	return \LucaDegasperi\OAuth2Server\Facades\Authorizer::getResourceOwnerId();
75
+        return \LucaDegasperi\OAuth2Server\Facades\Authorizer::getResourceOwnerId();
76 76
     }
77 77
 
78 78
     /**
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 use App\User;
8 8
 use Gate;
9 9
 
10
-class Controller extends BaseController{
10
+class Controller extends BaseController {
11 11
 
12 12
     /**
13 13
      * Return a JSON response for success.
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
      * @param  string $code
17 17
      * @return \Illuminate\Http\JsonResponse
18 18
      */
19
-	public function success($data, $code){
19
+	public function success($data, $code) {
20 20
 		return response()->json(['data' => $data], $code);
21 21
 	}
22 22
 
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      * @param  string $code
28 28
      * @return \Illuminate\Http\JsonResponse
29 29
      */
30
-	public function error($message, $code){
30
+	public function error($message, $code) {
31 31
 		return response()->json(['message' => $message], $code);
32 32
 	}
33 33
 
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
      * @return boolean
41 41
      * @see    https://lumen.laravel.com/docs/authorization 
42 42
      */
43
-    protected function authorizeUser(Request $request, $resource, $arguments = []){
43
+    protected function authorizeUser(Request $request, $resource, $arguments = []) {
44 44
     	
45
-    	$user 	 = User::find($this->getUserId());
46
-    	$action	 = $this->getAction($request); 
45
+    	$user = User::find($this->getUserId());
46
+    	$action = $this->getAction($request); 
47 47
 
48 48
         // The ability string must match the string defined in App\Providers\AuthServiceProvider\ability()
49 49
         $ability = "{$action}-{$resource}";
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
      * @param  \Illuminate\Http\Request  $request
62 62
      * @return bool
63 63
      */
64
-    public function isAuthorized(Request $request){
64
+    public function isAuthorized(Request $request) {
65 65
         return false;
66 66
     }
67 67
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      *
72 72
      * @return boolean
73 73
      */
74
-    protected function getUserId(){
74
+    protected function getUserId() {
75 75
     	return \LucaDegasperi\OAuth2Server\Facades\Authorizer::getResourceOwnerId();
76 76
     }
77 77
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      * @param  \Illuminate\Http\Request  $request
82 82
      * @return string
83 83
      */
84
-    protected function getAction(Request $request){
84
+    protected function getAction(Request $request) {
85 85
         return explode('@', $request->route()[1]["uses"], 2)[1];
86 86
     }
87 87
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      * @param  \Illuminate\Http\Request  $request
92 92
      * @return array
93 93
      */
94
-    protected function getArgs(Request $request){
94
+    protected function getArgs(Request $request) {
95 95
         return $request->route()[2];
96 96
     }
97 97
 }
Please login to merge, or discard this patch.