Skip to content

Commit 1fdb548

Browse files
author
ziming
committed
update docs a little
1 parent 8c7ba9d commit 1fdb548

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,26 @@ return [
7575
use Illuminate\Foundation\Auth\User;
7676
use Statsig\StatsigUser;
7777
use Ziming\LaravelStatsig\Utils\LaravelUserToStatsigUserConverter;
78+
use Ziming\LaravelStatsig\LaravelStatsigEvent;
79+
7880
$laravelStatsig = new Ziming\LaravelStatsig();
7981

8082
// The Facade Version is fine too
8183
LaravelStatsig::checkGate($user, '<gate_name>');
8284

83-
// You can set add this to your AppServiceProvider boot() method to
85+
// You can set add this to your ServiceProvider boot() method to
8486
// override the default laravel user to Statsig user conversion code too if you want
8587
LaravelUserToStatsigUserConverter::setLaravelUserToStatsigUserConversionCallback(function (User $laravelUser): StatsigUser {
8688
$statsigUser = StatsigUser::withUserID($laravelUser->getAuthIdentifier());
8789
$statsigUser->setCountry('US');
8890

8991
return $statsigUser;
9092
});
93+
94+
// Lastly you can also use LaravelStatsigEvent instead of StatsigEvent
95+
// as it accepts a laravel user object
96+
$statsigEvent = new LaravelStatsigEvent('event-name');
97+
$statsigUser->setUser(Auth::user());
9198
```
9299

93100
## Testing

0 commit comments

Comments
 (0)