Mego

Software Engineer at Kosice

Member Since 5 Years Ago

Svit

Experience Points
2,320
Total
Experience

2,680 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
17
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 1
2,320 XP
Jan
26
3 months ago
Activity icon

Replied to Send Verification E-mail, When It Is Changed By User

My index method call view, which will render "You are logged in". I think it's renamed Welcome view. Everything else is working OK, I dont think, that double route is problem, cause I can call the same controller method from more address (why should I not?)

I didn't wait, that something that basic are such big problem in Laravel :D

Jan
25
4 months ago
Activity icon

Replied to Send Verification E-mail, When It Is Changed By User

I understand, something is wrong with routes, but I don't know why. In my app/http/controllers/auth/VerificationController.php is something like this:

protected $redirectTo = '/home';

And in my routes something like this:

Route::get('/', '[email protected]')->middleware('verified');
Route::get('/home', '[email protected]')->middleware('verified');

Why am I getting the 404 error?

Activity icon

Replied to Send Verification E-mail, When It Is Changed By User

I tried to do another select before sending the verification e-mail. E-mail now come to right - new e-mail address, but verification link doesn't work. This is what I get, when I click the verification link in e-mail: https://snipboard.io/NHqhdz.jpg

I updated my code to this

$query = DB::table('users')->select('email')->where('id', '=', $user_id)->first(); //find user and his e-mail

        if($emails['old_email'] == $query->email) { // check if old e-mail is OK, it should be, cause it is prefilled in the disabled input
            if($emails['email'] == $emails['email2']) { // check if new emails equals
                if(DB::table('users')->where('id', $user_id)->update(['email' => $emails['email'], 'email_verified_at' => NULL])){
                    $newEmailAddress = User::select('email')->where('id', '=', $user_id)->first();  
                    $newEmailAddress->sendEmailVerificationNotification();  
                    $return = 1;
// the code continue
Activity icon

Replied to Send Verification E-mail, When It Is Changed By User

Thank you. It works. However, the e-mail is sent to an old e-mail address, so when I click the verification button, it goes to 404 error and don't verify the new e-mail address. Am I able to update? Or should I do a new "select" e-mail after the mail is updated?

Jan
24
4 months ago
Activity icon

Replied to Send Verification E-mail, When It Is Changed By User

When I try to write this, I am getting something like

Symfony\Component\Debug\Exception\FatalThrowableError Call to undefined method stdClass::sendEmailVerificationNotification() http://localhost/presbyteria/my-settings/change-email

Jan
23
4 months ago
Activity icon

Replied to Send Verification E-mail, When It Is Changed By User

Hello. About "NULL", it's working now. Thank you. But I am afraid, sendEmailVerificationNotification(); doesn't work. When E-mail is changed, database looks OK, but verification e-mail is not sent. I have added a

$user = new User;

into that model's function.

Please, see my code of that function:

public function tryChangeEmail($emails, $user_id) {
$user = new User;
        $return;

        $query = DB::table('users')->select('email')->where('id', '=', $user_id)->first(); //find user and his e-mail

        if($emails['old_email'] == $query->email) { // check if old e-mail is OK, it should be, cause it is prefilled in the disabled input
            if($emails['email'] == $emails['email2']) { // check if new emails equals
                if(DB::table('users')->where('id', $user_id)->update(['email' => $emails['email'], 'email_verified_at' => NULL])){
                    $user->sendEmailVerificationNotification();
                    $return = 1;
                } else {
                    $return = false;
                }
            } else {
                $return = 3;
            }
        } else {
            $return = 2;
        }

        return $return;
    }

This method is called in Controller, in $emails there are stored 3 mails (old_email, email and email2). email and email2 are new emails, which must equal. Everything is OK, until $user->sendEmailVerificationNotification(), that doesn't work.

And also, I would need to Log out user, when he change e-mail, cause new log-in with new e-mail address is required (there also a guard, to disable the whole application, until new e-mail address is verified by e-mail message).

How can I do that? And while verification e-mail is not sent?

Thank you

Jan
22
4 months ago
Activity icon

Started a new Conversation Send Verification E-mail, When It Is Changed By User

Hello, I am developing a system with users, which must have their e-mail addresses verified. In registration that is OK by almost default laravel function (with used vue auth). However, I can give users an opinion, to change their e-mail address any time.

So I have stored users in my DB, and they have "email" column and "email_verified_at" column. When user is registrated, the verification e-mail is sent, and "email_verified_at" is default set to NULL. This is OK.

When user change his e-mail inside my app, as logged user, I have two problems:

1 How can I set NULL value again to the "email_verified_at"? It is datetime, so when user has his email verified, the date and time is stored there. When he change the e-mail address, I need to set this value again to NULL, how can I do that? I have this query:

$doIt = DB::table('users')->where('id', $user_id)->update(['email' => $emails['email'], 'email_verified_at' => NULL]);

I am afraid, that this doesn't work.

2 How can I force Laravel to send new verification e-mail with verification link? Is here any method or something like this?

Thank you a million for a help. Have a nice day!