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

Sign in to participate in this thread!

Eventy

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.

© 2024 Laravel.io - All rights reserved.