/** * Register notification types. * * @return void */ public function registerNotificationTypes() { $blueprints = ['Flarum\\Core\\Notifications\\DiscussionRenamedBlueprint' => ['alert']]; event(new RegisterNotificationTypes($blueprints)); foreach ($blueprints as $blueprint => $enabled) { Notification::setSubjectModel($type = $blueprint::getType(), $blueprint::getSubjectModel()); User::addPreference(User::getNotificationPreferenceKey($type, 'alert'), 'boolval', in_array('alert', $enabled)); if ((new ReflectionClass($blueprint))->implementsInterface('Flarum\\Core\\Notifications\\MailableBlueprint')) { User::addPreference(User::getNotificationPreferenceKey($type, 'email'), 'boolval', in_array('email', $enabled)); } } }
public function register($key, callable $transformer = null, $default = null) { User::addPreference($key, $transformer, $default); }