network-rail-business-systems / laravel-date-timezone
This package is abandoned and no longer maintained.
No replacement package was suggested.
A simple package that sets the output of dates to a specific timezone while still maintaining UTC in the database
1.0.0
2022-09-02 13:12 UTC
Requires
- php: ^8.0
- illuminate/contracts: ^9.0
- spatie/laravel-package-tools: ^1.9.2
Requires (Dev)
- nunomaduro/collision: ^6.0
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^7.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
- spatie/laravel-ray: ^1.26
This package is auto-updated.
Last update: 2023-03-30 14:32:40 UTC
README
The package provides a custom cast class that can be applied to your model attributes and will output dates in your desired timezone while maintaining the application's globally set timezone when persisting to the database.
Installation
You can install the package via composer:
composer require network-rail-business-systems/laravel-date-timezone
You can publish the config file with:
php artisan vendor:publish --tag="date-timezone-config"
This is the contents of the published config file:
return [ 'output-timezone' => env('OUTPUT_TIMEZONE', config('app.timezone')) ];
Usage
protected $casts = [ 'created_at' => NetworkRailBusinessSystems\LaravelDateTimezone\Casts\DateTimezone::class; ]
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.