3 years ago

Before send / before route(s) fire

Posted 3 years ago by FutureWeb

Can I do

           if(!Auth::user()->email || is_null(Auth::user()->email))
                return redirect('/dashboard')->with('error', 'You have not provided an email address');

reason being I have a social login and twitter logins do not provide an email address nor do some facebook logins for some reason, if you can think of a better option then redirecting the user to the dashboard and a add email form please share it as on registration I send out a welcome email via an event handler and listener and it would save me putting the same logic in the controller before firing the event if that makes sense?

thanks in advance larapeeps.

p.s sorry the codes not formatting - Yah got there in the end!!!!

Please sign in or create an account to participate in this conversation.