Search
 
SCRIPT & CODE EXAMPLE
 

PHP

datetime validation in laravel

  return [
        'deadline' => 'required|date_format:Y-m-d H:i:s|after_or_equal:today',
    ];
Comment

Date time format for laravel validation

 $request->validate([
        'start_date' => 'date_format:d/m/Y',
        'end_date' => 'date_format:d/m/Y'
    ]);
Comment

laravel date validation

'dob' => 'required|date_format:Y-m-d|after_or_equal:1920-01-01'
Comment

validate time in laravel

public function store(IlluminateHttpRequest $request)
{
    $this->validate($request, [
        'time_start' => 'date_format:H:i',
        'time_end' => 'date_format:H:i|after:time_start',
    ]);

    // do other stuff
}
Comment

datetime validation in laravel

  return [
        'deadline' => 'date_format:Y-m-d H:i:s'
    ];
Comment

Laravel validation date

'start_date' => 'required|date|after:tomorrow'
Comment

laravel validate date

 'day'            =>  'required|date',
Comment

laravel validation date time format

public function validateDate($attribute, $value)
 {
   if ($value instanceof DateTimeInterface) {
     return true;
   }

   if ((! is_string($value) && ! is_numeric($value)) || strtotime($value) === false) {
     return false;
   }

   $date = date_parse($value);

   return checkdate($date['month'], $date['day'], $date['year']);
 }

############## OR ###################

public function validateDateFormat($attribute, $value, $parameters)
{
  if (! is_string($value) && ! is_numeric($value)) {
    return false;
  }

  $format = $parameters[0];

  $date = DateTime::createFromFormat('!'.$format, $value);

  return $date && $date->format($format) == $value;
}
Comment

PREVIOUS NEXT
Code Example
Php :: laravel check if record exists 
Php :: magento getcollection get first 
Php :: php override trait method and call it 
Php :: catch any exception php 
Php :: laravel collection slice 
Php :: what is the hashmap like in php 
Php :: how to execute cmd command in php 
Php :: hello world php 
Php :: ent_quotes in php 
Php :: artisan 
Php :: laravel fixed character limit 
Php :: get first name user 
Php :: wp_create_user 
Php :: Wordpress admin settings form 
Php :: What does PEAR stands for? 
Php :: Remove public from the url in the codeigniter 
Php :: installing php on ubuntu 
Php :: laravel truncate string laravel 8 
Php :: Unable to connect with STARTTLS: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed 
Php :: brew install php 5.6 
Php :: phpspreadsheet set cell by column and row 
Php :: php header redirect with parameters 
Php :: php convert string to chars 
Php :: php round up 
Php :: laravel 8 foreign key 
Php :: You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file laravel 
Php :: laravel blade loop if 
Php :: mysqli fetch row assoc 
Php :: wordpress get post featured image 
Php :: laravel natural sort 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =