diff --git a/app/Models/User.php b/app/Models/User.php index 76a3cbe..9f8c043 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -4,6 +4,7 @@ namespace App\Models; use App\Models\Traits\HasAccount; use App\Models\Traits\HasArea; +use DateTimeInterface; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; use Illuminate\Support\Str; @@ -65,6 +66,16 @@ class User extends Authenticatable }); } + /** + * 为数组 / JSON 序列化准备日期。 + * @param \DateTimeInterface $date + * @return string + */ + protected function serializeDate(DateTimeInterface $date) + { + return $date->format($this->dateFormat ?: 'Y-m-d H:i:s'); + } + protected function getNicknameAttribute() { return $this->info ? $this->info->nickname : ''; diff --git a/composer.json b/composer.json index 5af14ea..df84ab1 100644 --- a/composer.json +++ b/composer.json @@ -39,14 +39,14 @@ "autoload": { "psr-4": { "App\\": "app/", + "RuLong\\Identity\\": "packages/identity/src/", "Database\\Factories\\": "database/factories/", "Database\\Seeders\\": "database/seeders/" } }, "autoload-dev": { "psr-4": { - "Tests\\": "tests/", - "RuLong\\Identity\\": "packages/identity/src/" + "Tests\\": "tests/" } }, "minimum-stability": "dev", diff --git a/config/app.php b/config/app.php index 519f9b1..b6cc6d8 100644 --- a/config/app.php +++ b/config/app.php @@ -13,7 +13,7 @@ return [ | */ - 'name' => env('APP_NAME', 'Laravel'), + 'name' => env('APP_NAME', 'Laravel'), /* |-------------------------------------------------------------------------- @@ -26,7 +26,7 @@ return [ | */ - 'env' => env('APP_ENV', 'production'), + 'env' => env('APP_ENV', 'production'), /* |-------------------------------------------------------------------------- @@ -39,7 +39,7 @@ return [ | */ - 'debug' => (bool) env('APP_DEBUG', false), + 'debug' => (bool) env('APP_DEBUG', false), /* |-------------------------------------------------------------------------- @@ -52,9 +52,9 @@ return [ | */ - 'url' => env('APP_URL', 'http://localhost'), + 'url' => env('APP_URL', 'http://localhost'), - 'asset_url' => env('ASSET_URL', null), + 'asset_url' => env('ASSET_URL', null), /* |-------------------------------------------------------------------------- @@ -67,7 +67,7 @@ return [ | */ - 'timezone' => 'PRC', + 'timezone' => 'PRC', /* |-------------------------------------------------------------------------- @@ -80,7 +80,7 @@ return [ | */ - 'locale' => 'zh-CN', + 'locale' => 'zh-CN', /* |-------------------------------------------------------------------------- | Application Fallback Locale @@ -105,7 +105,7 @@ return [ | */ - 'faker_locale' => 'en_US', + 'faker_locale' => 'en_US', /* |-------------------------------------------------------------------------- @@ -118,9 +118,9 @@ return [ | */ - 'key' => env('APP_KEY'), + 'key' => env('APP_KEY'), - 'cipher' => 'AES-256-CBC', + 'cipher' => 'AES-256-CBC', /* |-------------------------------------------------------------------------- @@ -133,7 +133,7 @@ return [ | */ - 'providers' => [ + 'providers' => [ /* * Laravel Framework Service Providers... @@ -189,7 +189,7 @@ return [ | */ - 'aliases' => [ + 'aliases' => [ 'App' => Illuminate\Support\Facades\App::class, 'Arr' => Illuminate\Support\Arr::class, @@ -227,6 +227,7 @@ return [ 'URL' => Illuminate\Support\Facades\URL::class, 'Validator' => Illuminate\Support\Facades\Validator::class, 'View' => Illuminate\Support\Facades\View::class, + 'Wo' => App\Facades\Wo\Facade::class, ],