App\Http\Controllers\Auth\ActivationController::activate PHP Method

activate() public method

public activate ( $token = null )
    public function activate($token = null)
    {
        if ($token) {
            $user = Laralum::user('activation_key', $token);
            if ($token == 'resend') {
                # Resend the activation email
                $user->SendActivationEmail();
                # Redirect the user to the main page
                return redirect()->route('Laralum::activate_account')->with('success', trans('laralum.activation_email_sent'));
            } else {
                if ($user) {
                    if ($user->active) {
                        return redirect()->route('Laralum::activate_account')->with('error', trans('laralum.activation_user_already_activated'));
                    } else {
                        $user->active = true;
                        $user->save();
                        return redirect()->route('Laralum::activate_account')->with('success', trans('laralum.activation_account_activated'));
                    }
                } else {
                    # Redirect the user back to the activation page
                    return redirect()->route('Laralum::activate_account')->with('error', trans('laralum.activation_not_valid'));
                }
            }
        } else {
            # Return the activation form
            return view('auth/activate');
        }
    }
ActivationController