Hi i want to check if user email verified only in one function in a controller, i don't want to set the check in the middle-ware or in the route like this:
public function __construct()
{
$this->middleware('verified');
}
because the controller is accessible to guest also just one function (create) in the controller require email to be verified and user logged in how do i do that, thanks
public function create()
{
// checking if authenticated but need to check if email verified also
if (Auth::check()) {
// Get the currently authenticated user...
$user = Auth::user();
// get the list of states
$states = State::orderBy('name', 'asc')->get();
// get all cities by state_id
$state_id = '1';
$cities = City::where('state_id', $state_id)->orderBy('name', 'asc')->get();
return view('pages.create_product', ['user' => $user, 'states' => $states, 'cities' => $cities]);
} else {
return redirect()->route('login');
}
}