1
0
mirror of https://github.com/flarum/core.git synced 2025-10-14 08:24:28 +02:00

User Extender (prepareGroups functionality) (#2110)

This commit is contained in:
Alexander Skvortsov
2020-07-17 06:18:35 -04:00
committed by GitHub
parent 71abac0323
commit 37ebeb5705
5 changed files with 93 additions and 2 deletions

View File

@@ -31,6 +31,10 @@ class UserServiceProvider extends AbstractServiceProvider
{
$this->registerAvatarsFilesystem();
$this->registerDisplayNameDrivers();
$this->app->singleton('flarum.user.group_processors', function () {
return [];
});
}
protected function registerDisplayNameDrivers()
@@ -72,6 +76,14 @@ class UserServiceProvider extends AbstractServiceProvider
*/
public function boot()
{
foreach ($this->app->make('flarum.user.group_processors') as $callback) {
if (is_string($callback)) {
$callback = $this->app->make($callback);
}
User::addGroupProcessor($callback);
}
User::setHasher($this->app->make('hash'));
User::setGate($this->app->make(Gate::class));
User::setDisplayNameDriver($this->app->make('flarum.user.display_name.driver'));