Skip to content

Commit 89e451c

Browse files
authored
Added withData() method
Added a method to avoid creating an ActiveRecord instance for inserting custom fields into payload.
1 parent 479bc3a commit 89e451c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/JWTTools.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,14 @@ public function withModel(ActiveRecord $model, array $attributes = []): self
112112
return $this;
113113
}
114114

115+
public function withData($data = []): self
116+
{
117+
foreach($data as $k => $v){
118+
$this->payload->addExtraAttribute($k, $v);
119+
}
120+
return $this;
121+
}
122+
115123
public function getJWT(): string
116124
{
117125
try {

0 commit comments

Comments
 (0)