- vs-input-class.ts
- german datetime format for date attributes in coverage class
This commit is contained in:
parent
265cfbcd30
commit
e3ea9847a3
7 changed files with 66 additions and 20 deletions
|
@ -8,6 +8,8 @@ class Coverage extends Model
|
|||
{
|
||||
protected $table = 'coverage';
|
||||
public $timestamps = true;
|
||||
protected $dateFormat = 'Y-m-d H:i:s';
|
||||
// protected $dateFormat = 'd.m.Y H:i:s';
|
||||
|
||||
protected $fillable = [
|
||||
'elevation_min',
|
||||
|
@ -22,6 +24,35 @@ class Coverage extends Model
|
|||
'x_min', 'x_max', 'y_min', 'y_max'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be mutated to dates.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dates = [
|
||||
'time_min',
|
||||
'time_max',
|
||||
'time_absolut',
|
||||
];
|
||||
|
||||
public function setTimeAbsolutAttribute($value)
|
||||
{
|
||||
$this->attributes['time_absolut'] = \Illuminate\Support\Carbon::createFromFormat('d.m.Y H:i:s', $value);
|
||||
}
|
||||
public function setTimeMinAttribute($value)
|
||||
{
|
||||
$this->attributes['time_min'] = \Illuminate\Support\Carbon::createFromFormat('d.m.Y H:i:s', $value);
|
||||
}
|
||||
public function setTimeMaxAttribute($value)
|
||||
{
|
||||
$this->attributes['time_max'] = \Illuminate\Support\Carbon::createFromFormat('d.m.Y H:i:s', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* relationship to dataset
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function dataset()
|
||||
{
|
||||
return $this->belongsTo(Dataset::class, 'dataset_id', 'id');
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue