https://stackoverflow.com/questions/35565964/datetimecreatefromformat-and-incomplete-dates
DATES COMING FROM DATETIME PICKER:
03/15/2019
06:15 03/22/2019
<?php
/*
|--------------------------------------------------------------------------
| STORE NEW EVENT
|--------------------------------------------------------------------------
*/
public function store( EventDateRequest $request ) {
$event = new Event;
// Name is optional
if ( $request->has('event_name') )
$event->event_name = $request->event_name ;
$event->event_date = $this->formatPublishedAt( $request->event_date );
$event->published_at = $this->formatPublishedAt( $request->published_at ) ;
$event->is_active = $request->is_active;
$event->save() ;
Session::flash('success', 'Event Created successfully');
return redirect()->back() ;
}
/*
|--------------------------
| FORMAT DATE FOR DB
|--------------------------
*/
public function formatPublishedAt( $value ) {
$date = new \DateTime( $value );
return $date->format('Y-m-d H:i:s') ;
}
Will be converted to DB compatible format for storage