Support the ongoing development of Laravel.io →
posted 5 years ago
Laravel
Last updated 7 months 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 5 years ago.
0

Sign in to participate in this thread!

Cloudways

Your banner here too?

Robert N robertnicjoo Joined 19 Jul 2017

Moderators

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

Your logo here?

Laravel.io

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

© 2022 Laravel.io - All rights reserved.