Set a datetime attribute separately using a date and a time. This is especially helpful for input[type=date] and input[type=time].
limenet/laravel-datetime-attributes is a Laravel package for set a datetime attribute separately using a date and a time. this is especially helpful for input[type=date] and input[type=time]..
It currently has 0 GitHub stars and 1.396 downloads on Packagist (latest version v1.2.0).
Install it with composer require limenet/laravel-datetime-attributes.
Discover more Laravel packages by limenet
or browse all Laravel packages to compare alternatives.
Last updated
Set a datetime attribute separately using a date and a time. This is especially helpful for input[type=date] and input[type=time]
<?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);
}
}