limenet / laravel-datetime-attributes
Set a datetime attribute separately using a date and a time. This is especially helpful for input[type=date] and input[type=time].
Installs: 1 377
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 0
Open Issues: 0
Requires
- php: ^8.1
- illuminate/database: ^10.0 || ^11.0
- nesbot/carbon: ^2.0 || ^3.0
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- larastan/larastan: ^2.9.8
- laravel/pint: ^1.16.2
- nunomaduro/collision: ^7.0 || ^8.1.1
- orchestra/testbench: ^8.0 || ^9.1.2
- phpstan/extension-installer: ^1.4.1
- phpstan/phpstan-deprecation-rules: ^1.2.0
- phpstan/phpstan-phpunit: ^1.4.0
- phpunit/phpunit: ^10.5.27 || ^11.2.7
README
Set a datetime
attribute separately using a date
and a time
. This is especially helpful for input[type=date]
and input[type=time]
Usage
<?php use Illuminate\Database\Eloquent\Model as Base; use Limenet\LaravelDatetimeAttributes\DateTimeTrait; class Model extends Base { use DateTimeTrait; public function getStartDateAttribute() { return $this->dtGetDate('start'); } public function getStartTimeAttribute() { return $this->dtGetTime('start'); } public function setStartDateAttribute($value) { $this->dtSetDate('start', $value); } public function setStartTimeAttribute($value) { $this->dtSetTime('start', $value); } }