2019-03-20 17:40:14 +00:00
|
|
|
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
use App\Models\Dataset;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
|
|
class Coverage extends Model
|
|
|
|
{
|
|
|
|
protected $table = 'coverage';
|
|
|
|
public $timestamps = true;
|
2019-10-23 17:04:54 +00:00
|
|
|
protected $dateFormat = 'Y-m-d H:i:s';
|
|
|
|
// protected $dateFormat = 'd.m.Y H:i:s';
|
2019-03-20 17:40:14 +00:00
|
|
|
|
|
|
|
protected $fillable = [
|
|
|
|
'elevation_min',
|
|
|
|
'elevation_max',
|
|
|
|
'elevation_absolut',
|
|
|
|
'depth_min',
|
|
|
|
'depth_max',
|
2019-03-29 17:29:20 +00:00
|
|
|
'depth_absolut',
|
|
|
|
'time_min',
|
|
|
|
'time_max',
|
|
|
|
'time_absolut',
|
2019-09-02 14:58:08 +00:00
|
|
|
'x_min', 'x_max', 'y_min', 'y_max'
|
2019-03-20 17:40:14 +00:00
|
|
|
];
|
|
|
|
|
2019-10-23 17:04:54 +00:00
|
|
|
/**
|
|
|
|
* The attributes that should be mutated to dates.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $dates = [
|
|
|
|
'time_min',
|
|
|
|
'time_max',
|
|
|
|
'time_absolut',
|
|
|
|
];
|
|
|
|
|
|
|
|
public function setTimeAbsolutAttribute($value)
|
|
|
|
{
|
2019-12-03 13:41:44 +00:00
|
|
|
$this->attributes['time_absolut'] = \Illuminate\Support\Carbon::createFromFormat('d-m-Y H:i:s', $value);
|
2019-10-23 17:04:54 +00:00
|
|
|
}
|
|
|
|
public function setTimeMinAttribute($value)
|
|
|
|
{
|
2019-12-03 13:41:44 +00:00
|
|
|
$this->attributes['time_min'] = \Illuminate\Support\Carbon::createFromFormat('d-m-Y H:i:s', $value);
|
2019-10-23 17:04:54 +00:00
|
|
|
}
|
|
|
|
public function setTimeMaxAttribute($value)
|
|
|
|
{
|
2019-12-03 13:41:44 +00:00
|
|
|
$this->attributes['time_max'] = \Illuminate\Support\Carbon::createFromFormat('d-m-Y H:i:s', $value);
|
2019-10-23 17:04:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* relationship to dataset
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
2019-03-20 17:40:14 +00:00
|
|
|
public function dataset()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Dataset::class, 'dataset_id', 'id');
|
|
|
|
}
|
|
|
|
}
|