1

I want to display a message to the user after email verification. Getting an email to email verification after new user sign up to the website. There is a VerficationController. how I can modify to get the notification?


<?php

namespace App\Http\Controllers\Auth;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\VerifiesEmails;

class VerificationController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Email Verification Controller
    |--------------------------------------------------------------------------
    |
    | This controller is responsible for handling email verification for any
    | user that recently registered with the application. Emails may also
    | be re-sent if the user didn't receive the original email message.
    |
    */

    use VerifiesEmails;

    /**
     * Where to redirect users after verification.
     *
     * @var string
     */
    protected $redirectTo = RouteServiceProvider::HOME;

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('auth');
        $this->middleware('signed')->only('verify');
        $this->middleware('throttle:6,1')->only('verify', 'resend');
    }
}


1 Answer 1

1

You can override verified function like this.

    protected function verified(Request $request)
{
    $request->session()->flash('alert','You message here');
}

when the user will be verified this is will add a session and then where ever you redirecting you can get message from Session and can show message.

Like this:

@if(Session::has('alert'))
  <p class="alert {{ Session::get('alert-class', 'alert-info') }}">
    {{ Session::get('alert') }}
  </p>
@endif
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.