39 lines
752 B
PHP
39 lines
752 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use MongoDB\Laravel\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class Waypoint extends Model
|
|
{
|
|
protected $fillable = [
|
|
'sales_route_id',
|
|
'type',
|
|
'latitude',
|
|
'longitude',
|
|
'recorded_at',
|
|
'location_name',
|
|
'address',
|
|
'notes',
|
|
'photo_url',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'latitude' => 'decimal:8',
|
|
'longitude' => 'decimal:8',
|
|
'recorded_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get the sales route that owns the waypoint.
|
|
*/
|
|
public function salesRoute(): BelongsTo
|
|
{
|
|
return $this->belongsTo(SalesRoute::class);
|
|
}
|
|
}
|