first commit

This commit is contained in:
furen81
2026-01-23 19:18:52 +07:00
commit 6e681c4ad3
80 changed files with 13874 additions and 0 deletions

47
app/Models/SalesRoute.php Normal file
View File

@ -0,0 +1,47 @@
<?php
namespace App\Models;
use MongoDB\Laravel\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class SalesRoute extends Model
{
protected $fillable = [
'user_id',
'date',
'status',
'total_distance_km',
'total_duration_minutes',
'total_visits',
'started_at',
'ended_at',
];
protected function casts(): array
{
return [
'date' => 'date',
'total_distance_km' => 'decimal:2',
'started_at' => 'datetime',
'ended_at' => 'datetime',
];
}
/**
* Get the user that owns the route.
*/
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
/**
* Get the waypoints for the route.
*/
public function waypoints(): HasMany
{
return $this->hasMany(Waypoint::class)->orderBy('recorded_at');
}
}