October CMS resources and help articles

Simple and to the point. Optimized by the community.

Set default locale for newly registered backend users

3
by mohsin, last modified on March 16th, 2021

In your plugin's boot method:

        \Backend\Models\User::extend(function ($model) {
            $model->bindEvent('model.afterCreate', function () use ($model) {
                \Backend\Models\UserPreference::forUser($model)->set('backend::backend.preferences', ['locale' => 'es']);
            });
        });

Discussion

0 comments

We use cookies to measure the performance of this website. Do you want to accept these cookies?