Passed
Push — master ( 5d1dbf...ac3204 )
by Paul
04:29
created
src/Guards/TokenGuard.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 
21 21
             $accessToken = AccessToken::findToken($token);
22 22
 
23
-            if (! $accessToken) {
23
+            if (!$accessToken) {
24 24
                 return;
25 25
             }
26 26
 
Please login to merge, or discard this patch.
src/TinreServiceProvider.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -143,9 +143,9 @@  discard block
 block discarded – undo
143 143
 
144 144
     protected function registerTokenGuard()
145 145
     {        
146
-        Auth::resolved(function ($auth) {
147
-            $auth->extend('token', function ($app, $name, array $config) {
148
-                return tap($this->makeTokenGuard(), function ($guard) {
146
+        Auth::resolved(function($auth) {
147
+            $auth->extend('token', function($app, $name, array $config) {
148
+                return tap($this->makeTokenGuard(), function($guard) {
149 149
                     $this->app->refresh('request', $guard, 'setRequest');
150 150
                 });
151 151
             });
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
     
155 155
     protected function makeTokenGuard()
156 156
     {
157
-        return new RequestGuard(function ($request) {
157
+        return new RequestGuard(function($request) {
158 158
             return (new TokenGuard(
159 159
                 $request
160 160
             ))->user();
Please login to merge, or discard this patch.
src/Traits/HasPermissions.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@  discard block
 block discarded – undo
5 5
 trait HasPermissions
6 6
 {
7 7
     public function permissions() {
8
-        if($this->accessToken) {
8
+        if ($this->accessToken) {
9 9
             return $this->tokenPermissions($this->accessToken);
10 10
         }
11 11
 
12 12
         $permissions = config("tinre.role_permissions.{$this->role}");
13 13
 
14
-        if(in_array('*', $permissions)) {
14
+        if (in_array('*', $permissions)) {
15 15
             return config("tinre.permissions");
16 16
         }
17 17
         
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     public function apiPermissions() {
22 22
         $permissions = config("tinre.role_permissions.{$this->role}");
23 23
         
24
-        if(in_array('*', $permissions)) {
24
+        if (in_array('*', $permissions)) {
25 25
             $permissions = config("tinre.permissions");
26 26
         }
27 27
         
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
     {
33 33
         $tokenPermissions = $accessToken->permissions;
34 34
 
35
-        if(! is_array($tokenPermissions)) {
35
+        if (!is_array($tokenPermissions)) {
36 36
             return [];
37 37
         }
38 38
 
39 39
         $apiPermissions = $this->apiPermissions();
40 40
             
41
-        if(in_array('*', $apiPermissions)) {
41
+        if (in_array('*', $apiPermissions)) {
42 42
             return $apiPermissions;
43 43
         }
44 44
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     {
50 50
         $userPermissions = $this->permissions();
51 51
         
52
-        if(in_array($permission, $userPermissions)) {
52
+        if (in_array($permission, $userPermissions)) {
53 53
             return true;
54 54
         }
55 55
         
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 
59 59
     public function hasAnyPermission($permissions)
60 60
     {        
61
-        foreach($permissions as $permission) {
62
-            if($this->hasPermissionTo($permission)) {
61
+        foreach ($permissions as $permission) {
62
+            if ($this->hasPermissionTo($permission)) {
63 63
                 return true;
64 64
             }
65 65
         }
Please login to merge, or discard this patch.
database/migrations/2020_08_28_114153_create_access_tokens_table.php 1 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
     public function up()
15 15
     {
16
-        Schema::create('access_tokens', function (Blueprint $table) {
16
+        Schema::create('access_tokens', function(Blueprint $table) {
17 17
             $table->id();
18 18
             $table->bigInteger('user_id')->unsigned();
19 19
             $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
Please login to merge, or discard this patch.
routes/api/v1.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,6 +2,6 @@
 block discarded – undo
2 2
 
3 3
 use Illuminate\Support\Facades\Route;
4 4
 
5
-Route::middleware(['auth:api'])->group(function () {
5
+Route::middleware(['auth:api'])->group(function() {
6 6
     
7 7
 });
8 8
\ No newline at end of file
Please login to merge, or discard this patch.