NNTmux /
newznab-tmux
| 1 | <?php |
||
| 2 | |||
| 3 | namespace App\Observers; |
||
| 4 | |||
| 5 | use App\Jobs\SendNewRegisteredAccountMail; |
||
| 6 | use App\Jobs\SendWelcomeEmail; |
||
| 7 | use App\Models\User; |
||
| 8 | use Illuminate\Support\Facades\File; |
||
| 9 | use Illuminate\Support\Facades\Password; |
||
| 10 | use Jrean\UserVerification\Facades\UserVerification; |
||
| 11 | use Spatie\Permission\Models\Role; |
||
| 12 | |||
| 13 | class UserServiceObserver |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * Handle the user "created" event. |
||
| 17 | * |
||
| 18 | * |
||
| 19 | * @throws \Jrean\UserVerification\Exceptions\ModelNotCompliantException |
||
| 20 | */ |
||
| 21 | public function created(User $user): void |
||
| 22 | { |
||
| 23 | $roleData = Role::query()->where('id', $user->roles_id); |
||
| 24 | $rateLimit = $roleData->value('rate_limit'); |
||
| 25 | $roleName = $roleData->value('name'); |
||
| 26 | $user->syncRoles([$roleName]); |
||
| 27 | $user->update( |
||
| 28 | [ |
||
| 29 | 'api_token' => md5(Password::getRepository()->createNewToken()), |
||
|
0 ignored issues
–
show
|
|||
| 30 | 'rate_limit' => $rateLimit, |
||
| 31 | ] |
||
| 32 | ); |
||
| 33 | if (! empty(config('mail.from.address') && File::isFile(base_path().'/_install/install.lock'))) { |
||
| 34 | SendNewRegisteredAccountMail::dispatch($user)->onQueue('newreg'); |
||
| 35 | SendWelcomeEmail::dispatch($user)->onQueue('welcomeemails'); |
||
| 36 | UserVerification::generate($user); |
||
| 37 | |||
| 38 | UserVerification::send($user, 'User email verification required', config('mail.from.address')); |
||
| 39 | } |
||
| 40 | } |
||
| 41 | } |
||
| 42 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.