0

I want to use Laravel to develop an API for my app, and had installed the Homestead, but when I use command "php artisan make:model test" the following warning is displayed:

PHP Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /Users/liyanan/Code/Laravel/vendor/monolog/monolog/src/Monolog/Logger.php on line 311

I have tried to change the php.ini file in /ect like this

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = ‘Asia/Tokyo’

And change Laravel's app.php like this

'timezone' => ‘Asia/Tokyo’,

And Laravel's Logger.php like this

    date_default_timezone_set(‘Asia/Tokyo’);
    if (!static::$timezone) {
        static::$timezone = new \DateTimeZone(date_default_timezone_get() ?: ‘Asia/Tokyo’);
    }

    // php7.1+ always has microseconds enabled, so we do not need this hack
    if ($this->microsecondTimestamps && PHP_VERSION_ID < 70100) {
        $ts = \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)), static::$timezone);
    } else {
        $ts = new \DateTime(null, static::$timezone);
    }
    $ts->setTimezone(static::$timezone);

But it did not work, hope somebody could help me. Thanks.

Blackbam
  • 17,496
  • 26
  • 97
  • 150
AlenLee
  • 9
  • 4
  • 1
    you seem to use `smartquotes` ... in both files. Are you or this is a copy-paste error ? – YvesLeBorg Nov 16 '17 at 15:03
  • definitelly has to be only an issue with quotes, apart from them it looks good – moped Nov 16 '17 at 15:04
  • Not sure if the quote type might be it. Try changing the quote after the o in Tokyo to a ' instead of ’ Try changing date_default_timezone_set(‘Asia/Tokyo’); to date_default_timezone_set('Asia/Tokyo'); – justdan0227 Nov 16 '17 at 15:08
  • Yes ,looks like the quotes are problem,but I have replece them with ',but yet did not work,so the code is right? – AlenLee Nov 16 '17 at 15:17

0 Answers0