app/Http/Requests/Request.php
public function formatDateWithTime($date, $time = null)
    {
        if (!empty($date)) {
            if (!empty($time)) {
                return date('Y-m-d H:i:s', strtotime($date.' '.$time));
            }

            return date('Y-m-d H:i:s', strtotime($date));
        }

        return;
    }
public function formatDateWithTime($date, $time = null)
    {
        if (!empty($date)) {
            if (!empty($time)) {
                return date('Y-m-d H:i:s', strtotime($date.' '.$time));
            }

            return date('Y-m-d H:i:s', strtotime($date));
        }

        return;
    }
@param string      $date
@param string|null $time

@return bool|null|string