'date', 'total_distance_km' => 'decimal:2', 'optimized_at' => 'datetime', 'optimized_route' => 'array', ]; } /** * Get the user that owns the plan. */ public function user(): BelongsTo { return $this->belongsTo(User::class); } /** * Get the user that created the plan. */ public function creator(): BelongsTo { return $this->belongsTo(User::class, 'created_by'); } /** * Get the targets for the plan. */ public function targets(): HasMany { return $this->hasMany(PlanTarget::class, 'sales_plan_id')->orderBy('order'); } }