-
Modules/User/Observers/v1/UserObserver.php
Open in GitHubclass UserObserver { public function creating(User $user) { if ($user->role == null) { $role = Role::getName('writer')->first(); $user->role_id = $role->id; } } public function created(User $user) { $user->statuses()->create([ 'name' => 'pending', 'reason' => 'needs verification' ]); if (App::environment('local')) { // verify with mobile or mail(mobile is priority) $verify = new Verify; $verify->verify(new EmailVerify($user->withoutRelations())); } } }
-
Modules/User/Providers/UserServiceProvider.php
Open in GitHubclass UserServiceProvider extends ServiceProvider { // public function boot() { // User::observe(UserObserver::class); } }