Skip to content
Experts PHP
  • Web Tutorial Exercise
  • LARAVEL FRAMEWORK TUTORIAL
  • PYTHON TUTORIAL
  • LARAVEL 5.8
  • PHP TUTORIAL
  • HTML TUTORIAL
  • Mysql
  • C PROGRAM
  • PHP PROGRAM
Posted on October 23, 2018October 30, 2018 by jyoti

Laravel Email Validation

Today we will talk about how to validate email validation in laravel.When we create a register form and require validation on the email field.One way to register an email once you can not register the same email id.That is why we feel validation on the email field.The user validates the email field and informs that this email id is already exit.How is this validation implemented in laravel? You can read below.

<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use DB;
use Validator;
use Redirect;
public function emaivalidation(Request $req)
{
$email = $req->email;
$inputs = [
'email' => $email,
];
$rules = [
'email' => 'required|email|unique:users|max:50',
];
$messages = [
'email.required' => 'Please enter email',
'email.unique' => 'This email already exits.',
];
$validation = Validator::make($inputs, $rules, $messages);
if( $validation->fails() ){
return redirect()->back()->withInput()->with('errors', $validation->errors() );
}
$user_id = DB::table('users')->insert([
'email' =>$email 
]);
return redirect()->back()->with('message', 'Successfully.');
}

Post navigation

laravel form validation
array_combine() function PHP

Laravel Tutorial

  • Introduction
  • Types of Version in Laravel
  • Installation
  • Database Connection in Laravel
  • Laravel Application Structure
  • Laravel Route File
  • Middleware Create in Laravel
  • Controller Create in Laravel
  • Model Create in Laravel
  • Laravel Views
  • Laravel Migration
  • Authentication Create in Laravel
  • Namespace in Laravel
  • Include Function
  • CSRF Token
  • Insert query in Laravel by model
  • Update query in Laravel by model
  • Delete query in Laravel by model
  • Sort Query in laravel (Eloquent Sorting)
  • Limit Query Laravel
  • Join Queries Laravel
  • Count Query
  • Random Rows Ger Laravel Query
  • OFFSET with Limit Query
  • wherebetween Query
  • wherenotbetween Query

Calculators & Converter Tools

MD5 Hash Generator

Hypotenuse Calculator

Find and Replace Word Calculator

HTML Heading Tag Generator

Text Font Style Generator

AI Text Converter

Comma Remover Calculator

Comma Separator Calculator

Parentheses Removal Calculator

Slope Calculator & Converter

Temprature Converter

Speed Converter

What is My IP

Your Internet Speedtest

Ratio Calculator

Alexa Rank Checker

GST Calculator

Square(√) Root Calculator

Prime Numbers Calculator

Area of Circle Calculator

Percentage(%) Calculator

Hexa to Decimal Converter

Binary to Decimal Converter

HTML Minify Tools

Remove Blank Lines Minify Tools

Word Counter

Multiplication Calculator

Add Fraction Calculator

ODD Number Calculator

Even Number Calculator

Learn Programming Blog, Tutorials, PHP, MySQL, JavaScript & JQuery, Ajax, WordPress, Laravel, Web Development, Many Tools and Demos with Experts PHP.powered by Experts PHP

About us|Terms and Condition|Privacy Policy|Sitemap
Kmspico Download | Official KMS Activator Website [New Version 2024] Uw betrouwbare online apotheek Drogisterij Unique in Nederland Vavada вход позволяет мгновенно попасть в мир азартных игр и бонусов! Получи доступ и начни выигрывать прямо сейчас. Получите доступ без ограничений через vavada регистрация и наслаждайтесь всеми функциями платформы! AMLBot crypto service online: amlbot check - ETH, USDT TRC20/ERC20 and 5000+ coins. Receiving funds of illegal origin could lead the risk of having your funds frozen. The USDT is being tested for scams, mixers, darknet market