Closed emile-yamaji closed 6 years ago
Hello,
Thanks for suggestion, I think there must be a more general approch. I must dig deeper...
I think about something like that:
public function confirm($id, $confirmation_code)
{
$model = $this->guard ()->getProvider()->createModel();
$user = $model->whereId($id)->whereConfirmationCode($confirmation_code)->firstOrFail();
$user->confirmation_code = null;
$user->confirmed = true;
$user->save();
return redirect(route('login'))->with('confirmation-success', trans('confirmation::confirmation.success'));
}
What do you think ?
@bestmomo Thank you for answering. I think your approach is better than my approach.
I try to pull request with your approach !
ok ;)
vendor/bestmomo/laravel-email-confirmation/src/Traits/RegistersUsers.php
In Line 46, uses a fixed provider name. The name of the provider can be freely set in config, and there are cases where multiple providers are used. Therefore, I think that it would be better to allow you to select the provider you want to use.
How about the changes like the following?
vendor/bestmomo/laravel-email-confirmation/src/Traits/RegistersUsers.php
app/Http/Controllers/Admin/Auth/RegisterController.php
In the above example the admins provider is used. If provider is not selected, default users will be used. I'm not sure if this modification policy is suitable. Please give me your opinion.