0

I need to do sth like if email is verified display a <p> with some text on the homepage, not with routes if it s possible

@if(email is verified)
<p>hello there</p>
@endif
@else
<p>you need to verify your email address</p>

Do I need to create a controller or make changes in current VerificationController.php if I have set up an email ver like:

<?php

namespace App\Http\Controllers\Auth;

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

2

It depends on how you know a user is verified. If you have a database column for users with email_verified_at as nullable datetime you can do something like this:

//The authenticated user is verified, since there is a datetime
@if(Auth::user()->email_verified_at != null)
  //Do something
  @else
    //Do something else, since the authenticated user is not verified
@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.