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].
1,396
| Install | |
|---|---|
composer require limenet/laravel-datetime-attributes |
|
| Latest Version: | v1.2.0 |
| PHP: | ^8.3 |
| License: | MIT |
| Last Updated: | Apr 20, 2026 |
| Links: | GitHub · Packagist |
Maintainer: 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]
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);
}
}