File: /var/www/tracksgrid.com/app/Location.php
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Location extends Model
{
protected $fillable = [
'track_id',
'timestamp',
'lat',
'lon',
'speed',
'bearing',
'altitude',
'distance',
'accuracy',
'batt',
];
protected $hidden = [
'batt', 'bearing', 'created_at', 'updated_at'
];
protected $casts = [
'lat' => 'decimal:6',
'lon' => 'decimal:6',
'created_at' => 'datetime:d.m.Y H:i'
];
public function track() {
return $this->belongsTo(Track::class);
}
}