Skip to content

Commit 5da0e9d

Browse files
author
Luca Degasperi
committed
Merge pull request #8 from thylo/patch-2
Added timestamps to inserts methods
2 parents c11d530 + 47eb274 commit 5da0e9d

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

src/LucaDegasperi/OAuth2Server/Repositories/FluentSession.php

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
use League\OAuth2\Server\Storage\SessionInterface;
44
use DB;
5+
use Carbon\Carbon;
56

67
class FluentSession implements SessionInterface {
78

@@ -10,7 +11,9 @@ public function createSession($clientId, $ownerType, $ownerId)
1011
return DB::table('oauth_sessions')->insertGetId(array(
1112
'client_id' => $clientId,
1213
'owner_type' => $ownerType,
13-
'owner_id' => $ownerId
14+
'owner_id' => $ownerId,
15+
'created_at' => Carbon::now(),
16+
'updated_at' => Carbon::now()
1417
));
1518
}
1619

@@ -28,6 +31,8 @@ public function associateRedirectUri($sessionId, $redirectUri)
2831
DB::table('oauth_session_redirects')->insert(array(
2932
'session_id' => $sessionId,
3033
'redirect_uri' => $redirectUri,
34+
'created_at' => Carbon::now(),
35+
'updated_at' => Carbon::now()
3136
));
3237
}
3338

@@ -37,6 +42,8 @@ public function associateAccessToken($sessionId, $accessToken, $expireTime)
3742
'session_id' => $sessionId,
3843
'access_token' => $accessToken,
3944
'access_token_expires' => $expireTime,
45+
'created_at' => Carbon::now(),
46+
'updated_at' => Carbon::now()
4047
));
4148
}
4249

@@ -47,6 +54,8 @@ public function associateRefreshToken($accessTokenId, $refreshToken, $expireTime
4754
'refresh_token' => $refreshToken,
4855
'refresh_token_expires' => $expireTime,
4956
'client_id' => $clientId,
57+
'created_at' => Carbon::now(),
58+
'updated_at' => Carbon::now()
5059
));
5160
}
5261

@@ -55,7 +64,9 @@ public function associateAuthCode($sessionId, $authCode, $expireTime)
5564
$id = DB::table('oauth_session_authcodes')->insertGetId(array(
5665
'session_id' => $sessionId,
5766
'auth_code' => $authCode,
58-
'auth_code_expires' => $expireTime
67+
'auth_code_expires' => $expireTime,
68+
'created_at' => Carbon::now(),
69+
'updated_at' => Carbon::now()
5970
));
6071

6172
return $id;
@@ -119,6 +130,8 @@ public function associateScope($accessTokenId, $scopeId)
119130
DB::table('oauth_session_token_scopes')->insert(array(
120131
'session_access_token_id' => $accessTokenId,
121132
'scope_id' => $scopeId,
133+
'created_at' => Carbon::now(),
134+
'updated_at' => Carbon::now()
122135
));
123136
}
124137

@@ -135,7 +148,9 @@ public function associateAuthCodeScope($authCodeId, $scopeId)
135148
{
136149
DB::table('oauth_session_authcode_scopes')->insert(array(
137150
'oauth_session_authcode_id' => $authCodeId,
138-
'scope_id' => $scopeId
151+
'scope_id' => $scopeId,
152+
'created_at' => Carbon::now(),
153+
'updated_at' => Carbon::now()
139154
));
140155
}
141156

@@ -160,4 +175,4 @@ public function removeRefreshToken($refreshToken)
160175
->delete();
161176
}
162177

163-
}
178+
}

0 commit comments

Comments
 (0)