Skip to content

Instantly share code, notes, and snippets.

View lawjeremy's full-sized avatar
🎯
Focusing

Jeremy Law lawjeremy

🎯
Focusing
  • Manulife
  • Fergus, ON, Canada
View GitHub Profile
@lawjeremy
lawjeremy / Unique-today-validator
Last active December 21, 2015 14:48
Laravel validator extension for unique email today. Usage: unique_today:table_name
Validator::extend ( 'unique_today', function ( $attribute, $value, $parameters ) {
$var[0] = $value;
$results = DB::select('SELECT * FROM ' . $parameters[0] . ' WHERE email = ? AND DATE(created_at) = DATE(NOW());', $var);
if ( $results ) {
return false;