Support the ongoing development of Laravel.io →
Laravel
Last updated 2 weeks ago.
0

An option is to do it using a model event in your User model.

class User extends Authenticatable {
    protected static function boot()
    {
        parent::boot();

        static::created(function($user) {
            $user->assignRole(config('auth.defaults.role'));
        });
    }
}
Last updated 4 years ago.
0

Sign in to participate in this thread!

Cloudways

Your banner here too?

Robert N Robert N robertnicjoo Joined 19 Jul 2017

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.